This doesn't work, as (fn [x] (= (:x x) 1)) is never evaluated and the
function itself is always truthy.  (Same for the #(= (:x %) 1) version).

On Fri, Oct 2, 2015 at 9:00 AM, Colin Yates <colin.ya...@gmail.com> wrote:

> Alternatively you can do (cond-> {:x 1} (fn [x] (= (:x x) 1)) (assoc :x
> 2))
>
> On 2 Oct 2015, at 16:33, ru <soro...@oogis.ru> wrote:
>
> Thank you, Colin.
>
> This works:
>
> user=> (as-> {:x 5} x1 (if (> (get x1 :x) 3) (assoc x1 :y 6) x1) (if (<=
> (get x1 :x) 3) (assoc x1 :y 12) x1))
> {:y 6, :x 5}
>
> But without cond-> at all :( :)
>
> пятница, 2 октября 2015 г., 17:49:28 UTC+3 пользователь ru написал:
>>
>> Hi,
>>
>> Can I use in tests threading expression of cond->, and how?
>>
>> Thanx in advance,
>>   Ru
>>
>
> --
> 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 moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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 moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to