Sorry to keep revising things; here's an improved version of let->,
which better supports (as near as I can tell -- please try to break)
arbitrary let-style destructuring. (The previous version favored
single-symbol bindings, but I can imagine use cases where [a b :as
all] kinds of destructuring are useful.)

Perry

(defmacro let->
  "Like ->, but takes a binding form as first argument, the bound
  symbol(s) from which will carry the resulting value from each form."
  ([[bind init] form]
    (if (seq? form)
      `(let [~bind ~init] ~form)
      (list form init)))
  ([[bind init] form & more]
    `(let-> [~bind (let-> [~bind ~init] ~form)] ~...@more)))


--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to