On Sat, Feb 5, 2011 at 10:36 AM, Jason wrote:
> How about
>
> (%->
> starting-value
> (foo 3 %)
> (bar % arg2 arg3))
>
> This combines the standard shorthand argument form from the inline
> function with the threading. I also like be because the '%' stands
> out.
And this also presum
I wanted to see how long this thread would go before someone linked to
the old stuff. :-)
Despite turning up repeatedly, the issue has never been put to bed. I
suspect it is the name. There has been no consensus, as this thread
demonstrates. I vote for one I haven't seen yet. `=>`. It's two
charac
Hi,
Am 08.02.2011 um 22:11 schrieb B Smith-Mannschott:
> Ah. Indeed. And Mark Fredrickson's "let->" is equivalent to my
> thread-with macro. I even considered the name let->. I guess there's
> no wheel that can't be reinvented. ;-)
Yeah. Once per year or so. ;)
Sincerely
Meikel
--
You receive
On Tue, Feb 8, 2011 at 22:05, Meikel Brandmeyer wrote:
> Ah. A classic:
> http://groups.google.com/group/clojure/browse_thread/thread/66ff0b89229be894/c3d4a6dae45d4852
>
> Some more names in this old thread.
>
> Sincerely
> Meikel
Ah. Indeed. And Mark Fredrickson's "let->" is equivalent to my
th
On Sat, Feb 5, 2011 at 16:36, Jason wrote:
> How about
>
> (%->
> starting-value
> (foo 3 %)
> (bar % arg2 arg3))
>
> This combines the standard shorthand argument form from the inline
> function with the threading. I also like be because the '%' stands
> out.
This, or something very
Ah. A classic:
http://groups.google.com/group/clojure/browse_thread/thread/66ff0b89229be894/c3d4a6dae45d4852
Some more names in this old thread.
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to c
How about
(%->
starting-value
(foo 3 %)
(bar % arg2 arg3))
This combines the standard shorthand argument form from the inline
function with the threading. I also like be because the '%' stands
out.
On Feb 4, 3:05 pm, B Smith-Mannschott wrote:
> Clojure's threading macros -> a
On Sat, Feb 5, 2011 at 10:14, B Smith-Mannschott wrote:
> I considered that, but decided against it because vector is the
> conventional syntax for variable bindings in Clojure (let, fn,
> defrecord, ...) Once I'd decided to do that, it became clear that the
> first of the forms would become the
On Sat, Feb 5, 2011 at 00:19, Michael Ossareh wrote:
> On Fri, Feb 4, 2011 at 12:05, B Smith-Mannschott
> wrote:
>>
>> I came up with this macro, but I'm unsure what to call it:
>>
>> (defmacro thread-let [[varname init-expression :as binding] & expressions]
>> {:pre [(symbol? varname)
>>
On Fri, 04 Feb 2011 15:05:39 -0500, B Smith-Mannschott
wrote:
What should I name this thing? I'm concerned that "thread" is
confusing due to its dual meaning. let seems in line with clojure
conventions.
(thread-let [x ...] ...)
(thread-with [x ...] ...)
(thread-through [x ...] ...)
(let-> [x
On Fri, Feb 4, 2011 at 12:05, B Smith-Mannschott wrote:
> I came up with this macro, but I'm unsure what to call it:
>
> (defmacro thread-let [[varname init-expression :as binding] & expressions]
> {:pre [(symbol? varname)
> (not (namespace varname))
> (vector? binding)
>
Missing some parens there. Should be (->> (take 2)), of course.
On Feb 4, 12:53 pm, Alan wrote:
> Another solution, which is not especially satisfying but is worth
> considering, is to use the most-common thread style at the top level,
> and interweave some exceptions for the less-common style.
>
Another solution, which is not especially satisfying but is worth
considering, is to use the most-common thread style at the top level,
and interweave some exceptions for the less-common style.
(-> 10
range 20
(->> take 2))
or
(->> 10
(#(range % 20))
(take 2))
On Feb 4, 12:05 pm
On Fri, Feb 4, 2011 at 3:05 PM, B Smith-Mannschott
wrote:
> (defmacro thread-let [[varname init-expression :as binding] & expressions]
> {:pre [(symbol? varname)
> (not (namespace varname))
> (vector? binding)
> (= 2 (count binding))]}
> `(let [~@(interleave (repeat varna
Clojure's threading macros -> and ->> to be quite a win. It breaks
down when the expression to be chained together are not consistent in
nesting the threaded expression second or last. An idiomatic way to
gain the necessary flexibility seems to be via let:
(let [x (line-seq x)
x (sort x)
15 matches
Mail list logo