Re: idiomatic extension to -> / --> ?

2014-01-18 Thread t x
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

Re: idiomatic extension to -> / --> ?

2014-01-18 Thread Alex Baranosky
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 .

Re: idiomatic extension to -> / --> ?

2014-01-18 Thread Jozef Wagner
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

Re: idiomatic extension to -> / --> ?

2014-01-18 Thread Jordan Berg
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

Re: idiomatic extension to -> / --> ?

2014-01-18 Thread Alex Baranosky
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

Re: idiomatic extension to -> / --> ?

2014-01-17 Thread t x
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)

Re: idiomatic extension to -> / --> ?

2014-01-17 Thread Shaun Gilchrist
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

idiomatic extension to -> / --> ?

2014-01-17 Thread t x
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 %