mike.hoarn
2018-7-25 19:09:50

@mike.hoarn has joined the channel


khepin
2018-7-25 21:27:55

what’s The Right Way™©® to loop over (thread-receive) and break out of the loop on a special exit value returned fro (thread-receive)? I was doing: (thread (λ () (for ( [i (in-naturals)] [params (thread-receive)]) (define query (first params)) (define records (second params)) (apply query-exec (CONN) query (flatten records)))))) But since (thread-receive) receives a list, params only binds to the first item. I’m also not convinced that this will call (thread-receive) with every iteration



khepin
2018-7-25 21:30:37

That …. looks perfect!


khepin
2018-7-25 21:30:38

thanks


lexi.lambda
2018-7-25 21:31:47

If (thread-recieve) then produces a list, and you want to iterate over the list as well, do something like this using for*: (for* ([params (in-producer thread-receieve my-stop-value)] [param (in-list params)]) ....)


khepin
2018-7-25 21:38:57

Thanks!


krystal.maughan
2018-7-26 06:25:31

@krystal.maughan has joined the channel