I have the following:
(defn helper [initial funcs]
(loop [fns funcs
ans initial]
(if (empty? fns)
ans
(recur (rest fns)
(list (first fns) ans)))))
(defmacro => [initial & funcs]
(helper initial funcs))
(macroexpand-1
'(=> 2
#(+ % 2)
#(* 1 % 3)))
Is there something part of the idiomatic clojure / clojure core which does
the above? Basically, I like the idea of -> and -->, but I find that I
can't always guarantee (1) last element or (2) 2nd element.
The above lets me place the argument directly via #%
Question: is there something part of idiomatic clojure / clojure core that
already does the above?
Thanks!
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.