On Friday, July 19, 2013 7:18:15 AM UTC-7, Daniel Dinnyes wrote:
>
>  You are trying to pick it up on the wrong end. Check this out:
>
> (-> "test-string-with-lots-of-dashes"
>     (fn [x] (s/split x #"-"))
>     (fn [y] (interleave y (range)))
>     (fn [z] (s/join #"_" z))
>     (fn [z] (s/join " * " ["I am serious" z "Not Kidding!!" z])))
>
> The above code is not valid, as the -> macro sees the function 
> declarations as lists, and tries to thread the argument through it. It is 
> quite intuitive though IMHO. 
>


It's valid if you make them function calls.

user=> 
(-> "test-string-with-lots-of-dashes"
    ((fn [x] (s/split x #"-")))
    ((fn [y] (interleave y (range))))
    ((fn [z] (s/join #"_" z)))
    ((fn [z] (s/join " * " ["I am serious" z "Not Kidding!!" z]))))
"I am serious * test_0_string_1_with_2_lots_3_of_4_dashes_5 * Not Kidding!! 
* test_0_string_1_with_2_lots_3_of_4_dashes_5"

Maybe I'm missing the point of this example.

-- 
-- 
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/groups/opt_out.


Reply via email to