Re: thread-any macro "%>"

2014-11-23 Thread Robert Levy
Henrik, The reason for <> was that when at Akamai we had the idea to create a macro of this kind, we were aware of already established strong opinions for and against the idea of a threading macro with a specifiable position, by some in the Clojure community. Stephen Compall had been reading Sche

Re: thread-any macro "%>"

2014-11-23 Thread Krzysiek Herod
Thank you guys, I think "as->" does more or less what I wanted, so my example could be rewritten to: (defn csv-line->sql-line [table, line] (as-> % line (str % " ") (str/split % separator) (map csv-field->sql-field %) (str/join ", " %) (str/replace string

Re: thread-any macro "%>"

2014-11-15 Thread Henrik Eneroth
You can find this functionality in the Swiss Arrows library here: https://github.com/rplevy/swiss-arrows My first thought was that using the % symbol seems cleaner than the <> of Swiss Arrows. Thinking about it though, wouldn't overloading the % create trouble when you do want to use the litera

Re: thread-any macro "%>"

2014-11-15 Thread Gary Verhaegen
It also does not really care whether or not it is inside a ->, it just reads nicer when it is. (as-> 4 x (+ x 2) (* x 7) should return 42, although I can't check on my phone. On Saturday, 15 November 2014, Bronsa wrote: > Looks like I've been too fast in my reply, looking at the docstring I >

Re: thread-any macro "%>"

2014-11-15 Thread Bronsa
Looks like I've been too fast in my reply, looking at the docstring I see that I'm wrong and you're right. I didn't realize as-> could take more than one "body" On Sat, Nov 15, 2014 at 3:05 PM, Nicola Mometto wrote: > > as-> only binds the specified expression rather than each result in step > an

Re: thread-any macro "%>"

2014-11-15 Thread Nicola Mometto
as-> only binds the specified expression rather than each result in step and only works from within -> Timothy Baldridge writes: > That was added to clojure.core in 1.6 and is known as "as->" > https://clojuredocs.org/clojure.core/as-%3E > > > > On Sat, Nov 15, 2014 at 6:55 AM, Krzysiek Herod >

Re: thread-any macro "%>"

2014-11-15 Thread Timothy Baldridge
That was added to clojure.core in 1.6 and is known as "as->" https://clojuredocs.org/clojure.core/as-%3E On Sat, Nov 15, 2014 at 6:55 AM, Krzysiek Herod wrote: > Guys, what do you think about new thread macro (I would call it thread-any > and represent it as "%>"), that would require you to al