samth changed the topic of #racket to: Racket v7.3 has been released: https://blog.racket-lang.org/2019/05/racket-v7-3.html -- Racket -- https://racket-lang.org -- https://pkgs.racket-lang.org -- Paste at http://pasterack.org
libertyprime has quit [Remote host closed the connection]
dwdv has quit [Remote host closed the connection]
BitPuffin has quit [Remote host closed the connection]
BitPuffin has joined #racket
orivej_ has joined #racket
orivej has quit [Ping timeout: 245 seconds]
keep_learning has joined #racket
lockywolf has joined #racket
vraid has quit [Quit: Leaving]
orivej_ has quit [Ping timeout: 252 seconds]
aeth has joined #racket
lockywolf has quit [Remote host closed the connection]
endobson has joined #racket
efm has quit [Remote host closed the connection]
efm has joined #racket
lockywolf has joined #racket
sword865 has joined #racket
efm has quit [Remote host closed the connection]
efm has joined #racket
efm has quit [Read error: Connection reset by peer]
efm has joined #racket
lockywolf has quit [Ping timeout: 264 seconds]
lockywolf has joined #racket
dddddd has quit [Remote host closed the connection]
Sgeo__ has quit [Read error: Connection reset by peer]
Sgeo__ has joined #racket
YuGiOhJCJ has joined #racket
lockywolf_ has joined #racket
lockywolf has quit [Ping timeout: 264 seconds]
lockywolf_ has quit [Ping timeout: 258 seconds]
jao has quit [Ping timeout: 258 seconds]
lockywolf has joined #racket
endobson has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
endobson has joined #racket
endobson has quit [Ping timeout: 245 seconds]
endformationage has quit [Quit: WeeChat 2.5]
lockywolf_ has joined #racket
lockywolf has quit [Ping timeout: 245 seconds]
endobson has joined #racket
endobson has quit [Client Quit]
mzan has joined #racket
lockywolf_ has quit [Ping timeout: 244 seconds]
endobson has joined #racket
lockywolf has joined #racket
endobson has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
ng0 has joined #racket
<dzoe> Are let constructs in Racket proper tail calls?
lockywolf_ has joined #racket
<dzoe> I mean, if I do (let loop1 ((i 1)) (when (< i 5) (do-something) (loop1 (add1 i))) (let loop2 ((i i)) (when (< i 10) (do-something-else) (loop2 (add1 i))))) will it re-use current frame?
<dzoe> And yes, I understand that in order to do something different when (< i 5) or (< i 10) this is not the best way to do it. It is just minimal working example.
lockywolf has quit [Ping timeout: 245 seconds]
dustyweb has quit [Ping timeout: 245 seconds]
ZombieChicken has quit [Quit: WeeChat 2.5]
<dzoe> The documentation says the last expression of body is in tail position with respect to surrounding let form, so probably yes.
<dzoe> It always helps to ask at #racket ;-)
<rain1> the procedure you created with a named let can be tail called
<rain1> your example is hard to read because its on one line
<rain1> if I read it right, loop1 is not tail called but loop2 is
dwdv has joined #racket
<dzoe> Exactly, but if I change it for if/cond, both can be tail called - which is what I need.
lockywolf__ has joined #racket
lockywolf_ has quit [Ping timeout: 264 seconds]
mSSM has joined #racket
lockywolf_ has joined #racket
endobson has joined #racket
endobson has quit [Client Quit]
endobson has joined #racket
lockywolf__ has quit [Ping timeout: 246 seconds]
endobson has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
endobson has joined #racket
ArthurStrong has joined #racket
vraid has joined #racket
orivej has joined #racket
mSSM has quit [Read error: Connection reset by peer]
lockywolf_ has quit [Ping timeout: 245 seconds]
iyzsong has joined #racket
chl has joined #racket
m1dnight1 has quit [Quit: WeeChat 2.4]
lockywolf_ has joined #racket
endobson has quit [Ping timeout: 244 seconds]
chl has quit [Quit: WeeChat 2.5]
m1dnight_ has joined #racket
dddddd has joined #racket
lockywolf__ has joined #racket
lockywolf_ has quit [Ping timeout: 244 seconds]
<bremner> am I the only one that finds named let syntax odd?
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
iyzsong has quit [Quit: ZNC 1.7.1 - https://znc.in]
efm has quit [Ping timeout: 245 seconds]
sauvin has quit [Ping timeout: 245 seconds]
eagleflo has quit [Remote host closed the connection]
jao has joined #racket
<dzoe> Now this is strange. How can I find out why fx< (and unsafe-fx<) is considered a block for future while fxvector-ref/set! is not?
Sgeo__ has quit [Ping timeout: 245 seconds]
endformationage has joined #racket
vraid has quit [Quit: Leaving]
eagleflo has joined #racket
ng0 has quit [Remote host closed the connection]
ng0 has joined #racket
<dzoe> From te documentation it looks like fl< is future-safe and fx< is assumed to be as well, but in my tests fx< blocks the future and basically serializes everything.
<dzoe> And given the fact that fixnums should be really the cheapest type, I am really confused.
lockywolf__ has quit [Remote host closed the connection]
lockywolf__ has joined #racket
lockywolf__ has quit [Read error: Connection reset by peer]
lockywolf__ has joined #racket
lockywolf__ has quit [Remote host closed the connection]
<dzoe> Wow, it is not future-unsafe, the problem is if it is passed as argument reference, it does not get inlined.
<dzoe> Therefore if I want to provide custom compare function, I must (somehow) get around passing it as reference.
vraid has joined #racket
sword865 has quit [Quit: Connection closed for inactivity]
<dzoe> Alright, so everything actually works better than expected.
<dzoe> Now I can sort (make-fxvector (expt 2 28)) in 19s on my laptop using all 8 CPU threads.
<dzoe> (And using only 4G of memory)
<dzoe> Where is soegaard when I want to thank him? ;-)
<vraid> something something in the state of denmark.
<dzoe> He'll show up eventually.
<dzoe> My first attempt to solve this problem was an algorithm that took about 4 hours for 27 inputs (2^27) combinations.
<dzoe> He directed me at proper usage of fixnums/fxvectors and I was able to put it down to about 70 seconds.
<vraid> mind sharing the code?
<dzoe> Now with more fine-tuned algorithm I am down to 9 seconds for 2^27 and 19 seconds for 2^28
<dzoe> I will share it and actually I plan to write something more about it.
<dzoe> Argh
<dzoe> Pasterack is not working
<dzoe> Unpolished version: http://pasterack.org/pastes/28207
<dzoe> Basically it is futures-parallelized version of merge sort for fixnums only.
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
<dzoe> To use it in my application I just need to do (fxand v 4294967295) before actual comparisons and add a thread showing progress using gauge% (which is possible as I can keep track in a small fxvector of all futures and just sum it a few times per second and display - this is already tested approach)
<dzoe> (Yes, the customer "MUST" see the progress ... sigh ...)
<vraid> this is using quite a bit of memory.
<vraid> Generated in 132186.76147460937 ms
eagleflo has quit [Remote host closed the connection]
<dzoe> It is O(n) in memory consumption.
<dzoe> And as fixnums occupy 64bits/8bytes, it will always use (* 2 8 n) bytes of memory.
<dzoe> Explaining to the customer that they want to solve a NP-class problem in reasonable time was probably the hardest part.
<dzoe> They have a set of invoices' amounts and they want all possible combinations sorted from largest to smallest.
<vraid> perhaps running it on a laptop with 8GB of memory wasn't the best idea. :)
<vraid> all possible combinations!?
<dzoe> Oh, just lower it to (expt 2 27) and it should run fine.
<dzoe> Yes
<vraid> to give you some general business advice, not programming-specific
q9929t has joined #racket
<vraid> when a customer says they want something, they don't really want that exact thing. it's always up for interpretation
eagleflo has joined #racket
<dzoe> It is an optimization problem for some loan schemes. There is a requirement that the portfolio of invoices given to the bank as a liability must follow some rules.
<dzoe> And one of the rules states that the sum of invoices issued to single partner must not exceed given ratio.
<dzoe> Typically 1/3.
<dzoe> So the bank can check in O(n) time to find out if it is correct.
<dzoe> But to find the biggest combination that still fits is O(2^n) in number of invoices issued to single partner.
<dzoe> Heehee, yeah, right :)
<vraid> right, there are always compliance rules
<dzoe> The thing is they wanted this algorithm from their ERP system developer and they just had no clue.
<vraid> i wonder why
orivej has quit [Ping timeout: 244 seconds]
<dzoe> It is an interesting problem to solve and it pays off, so I am really happy.
<dzoe> Well, you can easily see that it is an exponential problem and it is the case that usually the largest set of invoices contained 25-28 invoices during the last months.
<dzoe> Honestly, I have no idea how to implement this efficiently on their platform (C# + MSSQL)
<dzoe> And although for the last few years I am doing mostly Racket, decade or two ago I was doing a lot of micro-optimization stuff in C and assembly.
<dzoe> It is really nice refreshment to use Racket _and_ create something heavily optimized that is actually useful.
q9929t has quit [Quit: q9929t]
orivej has joined #racket
ziyourenxiang has quit [Ping timeout: 244 seconds]
pera has joined #racket
sauvin has joined #racket
FreeFull has joined #racket
<BitPuffin> Does racket have something like an in-list but goes through any sub list recursively all in order?
<vraid> you could always use flatten
<BitPuffin> Hm yeah I suppose that will suffice! Thanks
_whitelogger has joined #racket
dbmikus has joined #racket
efm has joined #racket
sauvin has quit [Read error: Connection reset by peer]
casaca has quit [Ping timeout: 244 seconds]
travishinkelman has joined #racket
casaca has joined #racket
cartwright has joined #racket
cantstanya has quit [Ping timeout: 260 seconds]
acarrico has joined #racket
Ven`` has joined #racket
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mzan has quit [Quit: Leaving]
dan_f has joined #racket
jackhill has joined #racket
Ven`` has joined #racket
notzmv has quit [Ping timeout: 245 seconds]
ArthurStrong has quit [Quit: leaving]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dan_f has quit [Quit: dan_f]
pie_ has joined #racket
travishinkelman has quit [Quit: travishinkelman]
FreeFull has quit []
shwouchk has joined #racket
vraid has quit [Disconnected by services]
vraid has joined #racket
dddddd has quit [Remote host closed the connection]
pera has quit [Quit: leaving]
ubLIX has joined #racket
efm has quit [Ping timeout: 245 seconds]
ubLIX has quit [Quit: ubLIX]
efm has joined #racket
Sgeo has joined #racket
pera has joined #racket
ziyourenxiang has joined #racket
Sgeo_ has joined #racket
Sgeo has quit [Ping timeout: 244 seconds]
ng0 has quit [Quit: Alexa, when is the end of world?]