Re: Explaining the thrush -> operator.

2012-06-12 Thread Jacek Laskowski
On Tue, Jun 12, 2012 at 2:08 AM, Frank Siebenlist wrote: > (-> 2 >    (* 5) >    (+ 3)) It also resembles a waterfall (not very friendly term in our profession, but fits well in this case) where the result of an earlier computation is passed on down the stack. It also works very similarly to the

Re: Explaining the thrush -> operator.

2012-06-11 Thread Frank Siebenlist
Just nitpicking, but for me those thread-first/last operators beg for "proper" formatting with newlines and indentation to emphasize the "threading", like not: (-> 2 (* 5) (+ 3)) but: (-> 2 (* 5) (+ 3)) also as mentioned before, using thread-first and thread-last to name those mac

Re: Explaining the thrush -> operator.

2012-06-11 Thread Jacek Laskowski
On Sat, Jun 9, 2012 at 11:41 AM, Lucas Marinho wrote: > ((comp #(+ % 1) #(+ % 2)) 0) I couldn't resist. #(+ % 1) == inc #(+ % 2) == (partial + 2) They give much better-looking functional program. Hope you forgive me :-) Jacek -- Jacek Laskowski Functional languages (Clojure), Java EE, and

Re: Explaining the thrush -> operator.

2012-06-11 Thread Lucas Marinho
Very nice! One little problem I had while learning this operator was realizing that it was a macro and not simply a form of function composition (like an inverted 'comp'). So to convert something like ((comp #(+ % 1) #(+ % 2)) 0) to use thrush you would need to write (-> 0 (+ 2) (+ 1)) and N

Re: Explaining the thrush -> operator.

2012-06-10 Thread Fenton Travers
All fantastic comments...I was thinking why didn't i use - instead of plus! I'll fix these up soon. On Sun, Jun 10, 2012 at 6:05 AM, Ulises wrote: > Additional to all the positive comments, I'd suggest you use an > operator which is not commutative, otherwise the differences between > -> and ->

Re: Explaining the thrush -> operator.

2012-06-10 Thread Ulises
Additional to all the positive comments, I'd suggest you use an operator which is not commutative, otherwise the differences between -> and ->> are less evident. U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to c

Re: Explaining the thrush -> operator.

2012-06-10 Thread Tim Visher
On Fri, Jun 8, 2012 at 2:02 PM, fenton wrote: > I created a tutorial explaining what the thrush -> and ->> operator is. > > https://github.com/ftravers/PublicDocumentation/blob/master/clojure-thrush.md > > My tutorials are aimed at people who appreciate VERY explicit explanations, > which I think

Re: Explaining the thrush -> operator.

2012-06-09 Thread myriam abramson
This is all very nice but it seems to me to be a case of less is more (or more is less). I mean, if I am used to read inside out easily, this operator just makes my life harder. I don't plan to use it but unfortunately to understand other people's code, I have to switch mindset. On Sat, Jun 9, 20

Re: Explaining the thrush -> operator.

2012-06-09 Thread fenton
Noted and updated! Thx. On Friday, June 8, 2012 11:02:50 AM UTC-7, fenton wrote: > > I created a tutorial explaining what the thrush -> and ->> operator is. > > > https://github.com/ftravers/PublicDocumentation/blob/master/clojure-thrush.md > > My tutorials are aimed at people who appreciate VERY

Re: Explaining the thrush -> operator.

2012-06-09 Thread Baishampayan Ghose
Technically speaking, the -> & ->> macros are _not_ the thrush combinators. Fogus wrote about them sometime back http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/ and I think you should mention that in your document too. Nevertheless, very useful document! Regards, BG On Fri, Jun 8, 2012

Explaining the thrush -> operator.

2012-06-08 Thread fenton
I created a tutorial explaining what the thrush -> and ->> operator is. https://github.com/ftravers/PublicDocumentation/blob/master/clojure-thrush.md My tutorials are aimed at people who appreciate VERY explicit explanations, which I think there is a bit of a gap among current internet available