Map entries become vectors when piped thru a macro

Posted by Gavin Grover on Stack Overflow See other posts from Stack Overflow or by Gavin Grover
Published on 2013-10-27T08:42:58Z Indexed on 2013/10/27 9:54 UTC
Read the original article Hit count: 254

Filed under:

In Clojure, a map entry created within a macro is preserved...

(class (eval `(new clojure.lang.MapEntry :a 7)))
;=> clojure.lang.MapEntry

...but when piped thru from the outside context collapses to a vector...

(class (eval `~(new clojure.lang.MapEntry :a 7)))
;=> clojure.lang.PersistentVector

This behavior is defined inside LispReader.syntaxQuote(Object form) condition if(form instanceof IPersistentCollection).

Does anyone know if this is intended behavior or something that will be fixed?

© Stack Overflow or respective owner

Related posts about clojure