Re: Macro closing over atom gives "Can't embed object in code" error.

2010-09-19 Thread Nathan Sorenson
I think I understand; the unquote operator is not providing a reference to the underlying object itself, but is rather a procedure that translates the object into a code representation. Thank-you for the explanation. On Sep 19, 6:53 am, Stuart Sierra wrote: > A macro is a function which returns

Re: Macro closing over atom gives "Can't embed object in code" error.

2010-09-19 Thread Stuart Sierra
A macro is a function which returns a data structure representing code to be compiled. All literals (String, Integer, symbol, etc.) and basic data structures (lists, maps, etc.) can be compiled, as can functions. Most other non-literal objects *cannot* be compiled. What you probably want is not

Macro closing over atom gives "Can't embed object in code" error.

2010-09-18 Thread Nathan Sorenson
I am playing around with a macro to define accessor functions for a closed-over atom. Here is a simplified example: (defmacro hidden-atom [] (let [a (atom :hello)] `(defn get-value [] (deref ~a When I evaluate this macro, I get the error: "Can't embed object in code, maybe print-dup not