rsistentHashMap)]}
>>>
>>> And "get-distinct" has the same restriction, but in get-distinct I get
>>> this error:
>>>
>>> java.lang.AssertionError: Assert failed: (= (type %)
>>> clojure.lang.PersistentHashMap)
>>> at admin.con
.clj:40)
>>
>> The :post condition of "fetch" does not throw an error, so I know that
>> "fetch" is returning clojure.lang.PersistentHashMap. However, when I print
>> the return type of get-distinct, I am amazed to see that it is now
>> clojure.lang.Persis
fetch"
is returning clojure.lang.PersistentHashMap. However, when I print the return
type of get-distinct, I am amazed to see that it is now
clojure.lang.PersistentArrayMap. This function does almost nothing, so I am
surprised it changes the concrete implementation type of the return value.
The :post condition of "fetch" does not throw an error, so I know that
> "fetch" is returning clojure.lang.PersistentHashMap. However, when I print
> the return type of get-distinct, I am amazed to see that it is
> now clojure.lang.PersistentArrayMap. This fun
voke(controller.clj:40)
The :post condition of "fetch" does not throw an error, so I know that
"fetch" is returning clojure.lang.PersistentHashMap. However, when I print
the return type of get-distinct, I am amazed to see that it is
now clojure.lang.PersistentArrayMap. This fun
))
>>
>> Both of these functions return lazyseqs, as expected. The results from
>> both get run through a (reduce) function that does some minor filtering.
>> Yet in one case the return type (from the reduce function) is
>> clojure.lang.PersistentArrayMap
>>
et in one case the return type (from the reduce function)
> is clojure.lang.PersistentArrayMap and in the other it
> is clojure.lang.PersistentHashMap. I'd like to be able to write a :post
> condition that enforces strictness, but that seems impossible because I can
> not figure out wha
filtering. Yet in
one case the return type (from the reduce function)
is clojure.lang.PersistentArrayMap and in the other it
is clojure.lang.PersistentHashMap. I'd like to be able to write a :post
condition that enforces strictness, but that seems impossible because I can
not figure out what the
I am surprised that a map literal is clojure.lang.PersistentArrayMap but as
soon as I assign it to a var, it becomes clojure.lang.PersistentHashMap.
Are there any rules for being able to predict when these conversions occur?
user> (type {})
clojure.lang.PersistentArrayMap
user> (type
woops, merge is indeed the function you're after
2010/6/2 Laurent PETIT
> Hi,
>
> 2010/6/1 Ryan
>
>> I have the following
>>
>> user=> (class ({:one "1"} {:two "2"} {:three "3"}))
>> clojure.lang.PersistentArrayMap
Hi,
2010/6/1 Ryan
> I have the following
> user=> (class ({:one "1"} {:two "2"} {:three "3"}))
> clojure.lang.PersistentArrayMap
>
> but am a little confused as to how best to access the data
>
> for example:
> user=> (count ({:one &q
theres a function called merge
2010/6/1 Ryan
> I have the following
> user=> (class ({:one "1"} {:two "2"} {:three "3"}))
> clojure.lang.PersistentArrayMap
>
> but am a little confused as to how best to access the data
>
> for example:
>
I have the following
user=> (class ({:one "1"} {:two "2"} {:three "3"}))
clojure.lang.PersistentArrayMap
but am a little confused as to how best to access the data
for example:
user=> (count ({:one "1"} {:two "2"} {:three "3"})
13 matches
Mail list logo