Re: Help with decisions in threading macros

2015-11-05 Thread Oliver Hine
See also cond-> (Clojure core) and even condas-> (http://blog.juxt.pro/posts/condas.html) Oliy -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderat

Re: Help with decisions in threading macros

2015-11-04 Thread Timur Sungur
Thanks!! On Tue, Nov 3, 2015 at 7:38 PM Erik Assum wrote: > some->> > > Erik. > -- > i farta > > Den 3. nov. 2015 kl. 17.05 skrev Timur : > > Hi all, > > Often I need to make decisions in simple threading macros, for instance > consider the following code > > (->> m >:vector >(fi

Re: Help with decisions in threading macros

2015-11-03 Thread Erik Assum
some->> Erik. -- i farta > Den 3. nov. 2015 kl. 17.05 skrev Timur : > > Hi all, > > Often I need to make decisions in simple threading macros, for instance > consider the following code > > (->> m >:vector >(filterv #(= (:id %) (:id m))) >(reduce #(and %1 %2))) > >

Re: Help with decisions in threading macros

2015-11-03 Thread Atamert Ölçgen
Perhaps you can replace (reduce ...) with (every? true?), which works with empty collections. On Tue, Nov 3, 2015 at 6:05 PM, Timur wrote: > Hi all, > > Often I need to make decisions in simple threading macros, for instance > consider the following code > > (->> m >:vector >(fil

Help with decisions in threading macros

2015-11-03 Thread Timur
Hi all, Often I need to make decisions in simple threading macros, for instance consider the following code (->> m :vector (filterv #(= (:id %) (:id m))) (reduce #(and %1 %2))) In this case, if the result of filter is empty reduce throws an exception as it expects some val