Sent the following to clojure-dev - but then it turned out to be a closed
group for posting.
Posting here as well:
==================================================================
user> (class {})
clojure.lang.PersistentArrayMap
user> (class {1 1})
clojure.lang.PersistentArrayMap
user> (def m {1 1})
#'user/m
user> (class m)
clojure.lang.PersistentHashMap
The following change fixes the issue:
-------------------------------------------------
diff --git a/src/jvm/clojure/lang/Compiler.java
b/src/jvm/clojure/lang/Compiler.java
index 0898f07..2cacd27 100644
--- a/src/jvm/clojure/lang/Compiler.java
+++ b/src/jvm/clojure/lang/Compiler.java
@@ -2837,7 +2837,7 @@ public static class MapExpr implements Expr{
.parse(context == C.EVAL ? context
: C.EXPRESSION, ((IObj) form).meta()));
else if(constant)
{
- IPersistentMap m = PersistentHashMap.EMPTY;
+ IPersistentMap m = PersistentArrayMap.EMPTY;
for(int i=0;i<keyvals.length();i+= 2)
-------------------------------------------------
But an unwanted side-effect is that some tests (which wrongly depend on the
order of elements in a map) fail, since PersistentArrayMap grows by adding
new elements to the beginning of the internal array store.
1] test_pretty.clj#print-length-tests
2] sequences.clj#test-flatten-present
Thoughts/comments?
I'd like to fix and send a pull request!
Thanks,
jaju
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en