Hi folks,
I have some code where I wanted to:
- take a list of stuff (which includes another list inside)
- use 'seq-utils/flatten' to flatten the list
- use 'interpose' to add comma-delimiting strings between the elements
- print out the results, thereby creating comma-delimited output
I may choose between:
((comp
(fn [x] (apply println x))
(fn [x] (interpose ", " x))
seq-utils/flatten)
mr)
OR
(-> mr
seq-utils/flatten
((fn [x] (interpose ", " x)))
((fn [x] (apply println x))))
And I found the "->" notation marginally easier to interpret and
understand. Apart from appearance, are there any benefits to using ->
instead of the comp function? I happily concede that there exist nicer
ways to achieve this goal, but the question I wanted to raise
concerned the benefits of using -> vs comp or vice-versa.
Kev
Kev
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---