I hope -<> and <> becomes part of clojure core.
Q: How did you solve XYZ?
A: I used the Diamond Wand.
On Sat, Jan 18, 2014 at 1:36 AM, Alex Baranosky <
alexander.barano...@gmail.com> wrote:
> I think if you have to choose one that is idiomatic, you'd have to say it
> is as->, due to its inclusi
I think if you have to choose one that is idiomatic, you'd have to say it
is as->, due to its inclusion in clojure.core. I should start using that
pattern...
On Sat, Jan 18, 2014 at 12:47 AM, Jozef Wagner wrote:
> There is a Syntax threading library at
> https://github.com/LonoCloud/synthread .
There is a Syntax threading library at
https://github.com/LonoCloud/synthread . See it in action at
http://www.infoq.com/presentations/Macros-Monads
On Sat, Jan 18, 2014 at 9:18 AM, Jordan Berg wrote:
> You can also use as-> in 1.5+
>
> (-> 2
> (+ 2)
> (as-> x (* 1 x 3)))
>
> I like this
You can also use as-> in 1.5+
(-> 2
(+ 2)
(as-> x (* 1 x 3)))
I like this a bit more than the (#()) approach, personally
On Sat, Jan 18, 2014 at 12:07 AM, Alex Baranosky
wrote:
> What I think is the interesting part of the question is the inclusion of the
> word "idiomatic". I'm not sur
What I think is the interesting part of the question is the inclusion of
the word "idiomatic". I'm not sure swiss-arrows is idiomatic... that said I
don't know what would be considered idiomatic here.a
One solution I know of for examples like this is:
(-> 2
(+ 2)
(#(* 1 % 3)))
I'm not
You win. :-)
On Fri, Jan 17, 2014 at 11:26 PM, Shaun Gilchrist wrote:
> https://github.com/rplevy/swiss-arrows
>
>
> On Fri, Jan 17, 2014 at 11:05 PM, t x wrote:
>
>> I have the following:
>>
>> (defn helper [initial funcs]
>> (loop [fns funcs
>> ans initial]
>> (if (empty? fns)
https://github.com/rplevy/swiss-arrows
On Fri, Jan 17, 2014 at 11:05 PM, t x wrote:
> I have the following:
>
> (defn helper [initial funcs]
> (loop [fns funcs
> ans initial]
> (if (empty? fns)
> ans
> (recur (rest fns)
> (list (first fns) ans)
>
> (d
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 %