(defn destructure [binding-form] ...magic...) (defmacro let [forms body] `(let* ~(vec (destructure forms)) ~@body))
On Feb 7, 1:46 pm, CuppoJava <patrickli_2...@hotmail.com> wrote: > Actually that would be fine as a solution as well. I'm stumped as to > how to avoid repeating the same thing twice (once in function world > and once in macro world). > > ie. Let's assume that we have this destructuring function. How do we > use that do program a destructuring let macro? > > -Patrick > > On Feb 7, 3:32 pm, Ken Wesson <kwess...@gmail.com> wrote: > > > On Mon, Feb 7, 2011 at 3:01 PM, Meikel Brandmeyer <m...@kotka.de> wrote: > > > Hi, > > > > Am 07.02.2011 um 20:51 schrieb CuppoJava: > > > >> Thanks for your answer Meikel. > > > >> Your answer isn't that ugly. It's very similar to what I have as > > >> well. > > > >> I would like to know if you think it's possible to re-use "let" to do > > >> this. I feel like I'm re-inventing the wheel somewhat. > > > > I don't think you can use let without resorting to macros since let > > > itself is one. Once in macro, always in macro world. > > > > As fogus said: you could copy the logic from c.c/destructure and make it > > > do the calls instead of emitting code. But I don't think there is a > > > pre-fabricated function doing that. > > > Arguably there should be, with the let macro calling it to do the > > heavy lifting but also available for direct user use. > > -- 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