Macro help

Jan 08, 2013 16:08


So I'm finding myself writing macros that look like this
(defmacro set-from-map [objform valmapform & set-pairs]
  (let [obj (gensym)
        valmap (gensym)]
    `(let [~obj    ~objform
           ~valmap ~valmapform]
       (other stuff happens here))))
Those top two lets are basically just letting me make obj and valmap strict -- making them evaluate ( Read more... )

Leave a comment

Comments 2

ext_1465808 January 9 2013, 12:55:20 UTC
Your example above could be written shorter as ( ... )

Reply

dudley_doright January 10 2013, 20:18:16 UTC
Yes, this is perfect, thank you ^_^

The reason I couldn't just use the foo# form is that I had a syntax quote embedded in some code spliced into another syntax quote, and I couldn't "see" gensyms created in the outer syntax quote from the inner syntax quote.

Reply


Leave a comment

Up