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
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
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)))
>
>
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
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