Yes, it was working as a reader macro and messing me up.  Using
hashmap worked.  Thanks.

On Feb 3, 8:03 pm, "Stephen C. Gilardi" <squee...@mac.com> wrote:
> 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
> 3KViewDownload
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to