Clojure design patterns

2017-11-22 Thread Jacek Grzebyta
That is my latest discovery. Very good blog with common design patterns implemented in clojure: http://mishadoff.com/blog/clojure-design-patterns/ All the best, J -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to c

Re: Lazy Flatten; One seq at a Time

2017-11-22 Thread Stephen Nelson
``` (->> (repeatedly (fn [] (lazy-seq (println "New seq...") (map (fn [x] + x (rand-int 10)) (range 4) (apply concat) (take 1)) New seq... => (3) ``` Lazy-flatten is unnecessary because concat already does what you want – the generalised problem

Re: Calling conform from within a macro

2017-11-22 Thread Stanislav Yurin
Thanks a million! On Wed, Nov 22, 2017 at 15:59 Alex Miller wrote: > Your example does work, but it returns the conformed value [a b c] out of > the macro, which the compiler then tries to evaluate. So the exception is > coming downstream. > > See: > > user=> (macroexpand '(test-macro a b c)) >

Re: Calling conform from within a macro

2017-11-22 Thread Alex Miller
Your example does work, but it returns the conformed value [a b c] out of the macro, which the compiler then tries to evaluate. So the exception is coming downstream. See: user=> (macroexpand '(test-macro a b c)) [a b c] On Wednesday, November 22, 2017 at 1:08:22 AM UTC-6, Stanislav Yurin wr

Re: Lazy Flatten; One seq at a Time

2017-11-22 Thread Matt Anderson
Thanks! The `aconcat` solution from plumbing works great for this use case. The `lazy-gen`/`yield` fn's in Tupelo are exactly what I was searching for in terms of a larger abstraction, but couldn't quite put into words. Thanks for the tip! On Wednesday, November 22, 2017 at 2:36:18 AM UTC-5,

Re: functional implementation of core.async primitives

2017-11-22 Thread Timothy Baldridge
I'm not exactly sure how the library works, honestly. It's seems that we still don't have parking take, instead we have callbacks again? I'd love to see an implementation of something like this with your library: (go (println "Count" (loop [acc 0] (if-some [v ( wrote: > Thanks for the

Re: functional implementation of core.async primitives

2017-11-22 Thread Divyansh Prakash
Thanks for the encouragement, Jay! I ported the library over to JS, and now we have coroutines in vanilla JavaScript! Porting it to other systems should be fairly straightforward. 😀 - Divyansh -- You received this message because you are subscribed to