Ups, I'm not aware of that thread...I just found a more general threading 
operator handy sometimes.
I do kinda agree that we shouldn't necessarily encourage threading in arbitrary 
positions.
However, I can't quite follow your second argument.
While it does mean two different things, I don't see the problem with that.
We could use _ instead of :? to indicate we don't care about the 'meaning'.

Anyway, I'll delete this evil hack from my repository ;)


On 19/07/2011, at 10:33 AM, Sean Corfield wrote:

> Requests for a "more general" threading macro are usually met with a
> link to the thread where Rich says this is not needed and we should
> not encourage functions that need threading anywhere except the first
> or last position. I don't have the link handy (sorry).
> 
> The usual objection centers around the fact that whatever symbol is
> used for the binding position then becomes a "varying" thing within
> the expression:
> 
> (-newthread-> "x"
>         (str "y" :? "z")
>         (str "a" :? "b")
>         println)
> 
> Here :? means two different things which seems counter to how Clojure
> works elsewhere...
> 
> Sean
> 
> On Mon, Jul 18, 2011 at 5:10 PM, Andreas Kostler
> <andreas.koestler.le...@gmail.com> wrote:
>> Maybe you might find this useful
>> 
>> (defmacro ->
>>        ([x] x)
>>        ([x form] (if (seq? form)
>>                      (with-meta (replace {:? x} form) (meta form))
>>                      (list form x)))
>>        ([x form & more] `(-> (-> ~x ~form) ~@more)))
>> 
>> This allows for a more flexible threading operation:
>> 
>> user> (-> "c"
>>              (third-param "a" "b" :? "d")
>>              println)
>> first a second b third c fourth d
>> nil
>> 
>> Cheers
>> Andreas
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to