Michael Blume (dudley_doright) wrote,

Macro help

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 immediately instead of *pasting their code* wherever my macro might use them. I'm seeing this pattern a lot, and of course, Patterns Are Evil. Can anyone see an easy way to eradicate it?
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 2 comments