The 5 is just the last part of the equality statement. This might be easier
to see by adding in a "let":

(let [x (__ (sort (rest (reverse [2 5 4 1 3 6]))))
      y (-> [2 5 4 1 3 6] (reverse) (rest) (sort) (__))]
  (= x y 5))

- James


On 30 April 2014 18:09, Roelof Wobben <rwob...@hotmail.com> wrote:

>
>
> Op woensdag 30 april 2014 18:46:36 UTC+2 schreef James Reeves:
>
>> These two forms are equivalent:
>>
>>     (__ (sort (rest (reverse [2 5 4 1 3 6]))))
>>
>>     (-> [2 5 4 1 3 6] (reverse) (rest) (sort) (__))
>>
>> The -> macro turns the second form into the first. You can see this by
>> running macroexpand-all:
>>
>>     (require '[clojure.walk :refer [macroexpand-all]])
>>
>>     (macroexpand-all '(-> [2 5 4 1 3 6] (reverse) (rest) (sort) (__)))
>>
>> This should produce:
>>
>>    (__ (sort (rest (reverse [2 5 4 1 3 6]))))
>>
>> - James
>>
>>
>>
> That what I expected.  what is the benefit of this if the first forms
> already gives the right answer.
> The only thing I still do not see is what the 5) is doing here.
>
> It looks to me of writing something very difficult  where it could be done
> very easy with just the first form.
>
> Roelof
>
>
>

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