Re: What is juxt really doing?

2017-07-16 Thread lawrence . krubner
Thank you for all the responses. The examples of using juxt to sort among results that are otherwise the same is a good example. On Sunday, July 16, 2017 at 3:18:07 AM UTC-4, Boris V. Schmid wrote: > > I don't use juxt much, but the example that I did pick up is where juxt is > used for sortin

Re: Predicates for atom/ref/agent

2017-07-16 Thread Alex Miller
The decisions for volatile? vs other predicates were made at different times so I don't think there is necessarily any guiding design principle behind having one vs not having the other. I wrote the volatile addition, but I don't remember any of the details around why we included volatile? at t

Predicates for atom/ref/agent

2017-07-16 Thread Shantanu Kumar
Hi, Since Clojure 1.7 there's a `volatile?` predicate function, but no such equivalent for atom/ref/agent. Can anybody explain the rationale behind the difference? I found an old thread on a related topic (URL below) but would like to know if there's an updated explanation. https://groups.googl

Re: What is juxt really doing?

2017-07-16 Thread Colin Yates
(defn ->k->node [m k] (into {} (map (juxt k identity) m)) is really useful, particularly (->k->node m :id) On Sunday, 16 July 2017, wrote: > If I do this: > > ((juxt :who :what :when) {:who 1 :when 2} {:who 4 :what 99}) > > I get: > > [1 {:who 4, :what 99} 2] > > Why does a map come back instead

Re: What is juxt really doing?

2017-07-16 Thread Boris V. Schmid
I don't use juxt much, but the example that I did pick up is where juxt is used for sorting on one function first, and in the case of a tie, on the second function. That is quite useful to me. > (sort-by (juxt first second) (map vector (repeatedly 10 #(rand-int 3)) (shuffle (range 10 ([0 1