More examples in clojure 1.3.0:

user=> {[1 2 3] :vector '(1 2 3) :list}
{[1 2 3] :list}

but

user=> #{[1 2 3] (1 2 3)}
IllegalArgumentException Duplicate key: (1 2 3) 
 clojure.lang.PersistentHashSet.createWithCheck (PersistentHashSet.java:68)

... anyone has an explanation? 

Juan Manuel

On Tuesday, April 3, 2012 10:55:26 AM UTC+2, mnicky wrote:
>
> Another interesting fact is that:
>
> Clojure 1.2.1
> user=> {'(1) :list [1] :vector}
> java.lang.IllegalArgumentException: Duplicate key: (1) (NO_SOURCE_FILE:0)
>
> Clojure 1.3.0
> user=> {'(1) :list [1] :vector}
> {(1) :vector}
>
> Clojure 1.4.0-beta1
> user=> {'(1) :list [1] :vector}
> {(1) :vector}
>
> ...but I don't know what's going on.
>
>
> On Tuesday, April 3, 2012 9:11:50 AM UTC+2, JuanManuel Gimeno Illa wrote:
>>
>> Playing with some problems of 4clojure, I wanted to make a map which, for 
>> each empty collection, returns a keyword. But it seems that it is 
>> impossible to have both an empty list and an empty vector in the same map.
>>
>> user=> {() :list}
>> {() :list}
>> user=> {() :list [] :vector}
>> IllegalArgumentException Duplicate key: 
>> clojure.lang.PersistentList$EmptyList@1 
>>  clojure.lang.PersistentArrayMap.createWithCheck 
>> (PersistentArrayMap.java:70)
>> user=> {[] :vector}
>> {[] :vector}
>>
>> I supposed that this is due to (= [] ()) but
>>
>> user=> {'(1) :list [1] :vector}
>> {(1) :vector}
>> user=> (= [1]'(1))
>> true
>>
>> What am I missing?
>>
>> Juan Manuel
>>
>

-- 
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

Reply via email to