Hello,

On 21 Okt., 19:08, Chouser <[EMAIL PROTECTED]> wrote:
> Here's my implementation:
>
> (defmacro >>_ [& exprs]
>   (list 'let (apply vector (mapcat (fn [expr] (list '_ expr)) exprs)) '_ ))
Now this is a nice idea.

> I used it a couple times after first writing it, but have since failed
> to find much use for it.  I guess I wouldn't really recommend it.
I often encountered the case, that I want to do an apply in the
-> or eg. some filter or map, which also does not work. But maybe
you are right, and this is a sign that the code is bad.

Nevertheless here a combined version, which does not need to
specify the _ all the time.

(defmacro >>
  [x & forms]
  `(let ~(apply vector
                '_ x
                (mapcat (fn [form]
                          (if (seq? form)
                            (if (some #(= '_ %) form)
                              (list '_ form)
                              (list '_ (list* (first form) '_ (rest
form))))
                            (list '_ (list form '_))))
                        forms))
     ~'_))

Sincerely
Meikel
--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to