The problem is in embedding an actual function object instead of a
form which creates the function object. That results in a form which
can't be read properly and thus the cryptic error.
Regards,
BG
On Sat, Apr 28, 2012 at 9:13 PM, Shantanu Kumar
wrote:
> Hi,
>
> I am running into error when usi
On Apr 28, 9:32 pm, Armando Blancas wrote:
> Seems like the expansion is trying to put the function's value in there,
> and this has already been compiled. If the function' code is expanded
> in-place it works.
True. Thanks for confirming this.
Shantanu
--
You received this message because y
Seems like the expansion is trying to put the function's value in there,
and this has already been compiled. If the function' code is expanded
in-place it works.
user=> (defmacro bar
[a]
(let [b (keyword a)
f `(fn [& args#] ~b)]
`(deftype ~a []
clojure.lang.ILookup
This macroexpansion looks fine to me... but still gives an error when you
try to call (bar alex).
(defmacro bar
[a]
(let [b (keyword a)
f-gensym (gensym "f")]
`(let [~f-gensym (fn [& args#] ~b)]
(deftype ~a []
clojure.lang.ILookup
(valAt [this# k#] (~f-gens
> I had to play with this because it seemed like for some reason you were
> trying to call it on my name :)
I appreciate you chimed in, though the mention of your name was purely
coincidental. :)
> So far one thing I've isolated is that if you cut out the function calls it
> will compile the macr
Hi Shantanu,
I had to play with this because it seemed like for some reason you were
trying to call it on my name :)
So far one thing I've isolated is that if you cut out the function calls it
will compile the macro:
(defmacro bar
[a]
(let [b (keyword a)
f (fn [& args] b)]
`(deft
Hi,
I am running into error when using macros with deftype. For example,
when I use the macro `foo` it works fine:
(defmacro foo
[a]
(let [b (keyword a)]
`(do ~b)))
(foo alex)
=> :b
whereas, when I use the macro `bar`:
(defmacro bar
[a]
(let [b (keyword a)
f (fn [& args] b)]