On Feb 3, 2009, at 7:45 PM, Jeffrey Straszheim wrote:
Btw, I fixed the ~ needed on relation. It didn't help. It seems I
just can't put a ~@ form inside of a { } set builder.
{ } reads a literal map. It appears to expect an even number arguments between the curly braces at read time. You can work around this by calling hash-map instead of using a map literal.
#{ } reads a literal set. That works.
Some examples:
user=> (defmacro j [& formals] `...@formals})
#'user/j
user=> (j 1 2 3 4)
#{1 2 3 4}
user=> (defmacro j [& formals] `...@formals})
java.lang.ArrayIndexOutOfBoundsException: 1
java.lang.Exception: Unmatched delimiter: )
user=> (defmacro j [& formals] `(hash-map ~...@formals))
#'user/j
user=> (j 1 2 3 4)
{1 2, 3 4}
My impression is that the preferred way to write this would be the one
calling hash-map. I'm not exactly sure why the one using #{} works.
--Steve
smime.p7s
Description: S/MIME cryptographic signature
