If that is the case, it could be implemented using transients for a
performance increase.
On Oct 30, 10:53 am, Alex Osborne wrote:
> Chouser wrote:
> > On Fri, Oct 30, 2009 at 11:30 AM, Alex Osborne wrote:
> >> John Harrop wrote:
> >>> Was something wrong with this?:
>
> >>> (defn my-zipmap
> >
Chouser wrote:
> On Fri, Oct 30, 2009 at 11:30 AM, Alex Osborne wrote:
>> John Harrop wrote:
>>> Was something wrong with this?:
>>>
>>> (defn my-zipmap
>>> "Returns a map with the keys mapped to the corresponding vals."
>>> [keys vals]
>>> (into {} (map vec (partition 2 (interleave keys va
On Fri, Oct 30, 2009 at 11:44 AM, John Harrop wrote:
> On Fri, Oct 30, 2009 at 11:37 AM, Chouser wrote:
>>
>> On Fri, Oct 30, 2009 at 11:30 AM, Alex Osborne wrote:
>> >
>> > John Harrop wrote:
>> >> Was something wrong with this?:
>> >>
>> >> (defn my-zipmap
>> >> "Returns a map with the keys
On Fri, Oct 30, 2009 at 11:37 AM, Chouser wrote:
> On Fri, Oct 30, 2009 at 11:30 AM, Alex Osborne wrote:
> >
> > John Harrop wrote:
> >> Was something wrong with this?:
> >>
> >> (defn my-zipmap
> >> "Returns a map with the keys mapped to the corresponding vals."
> >> [keys vals]
> >> (int
On Fri, Oct 30, 2009 at 11:30 AM, Alex Osborne wrote:
>
> John Harrop wrote:
>> Was something wrong with this?:
>>
>> (defn my-zipmap
>> "Returns a map with the keys mapped to the corresponding vals."
>> [keys vals]
>> (into {} (map vec (partition 2 (interleave keys vals)
>>
>> :)
>
> O
John Harrop wrote:
> Was something wrong with this?:
>
> (defn my-zipmap
> "Returns a map with the keys mapped to the corresponding vals."
> [keys vals]
> (into {} (map vec (partition 2 (interleave keys vals)
>
> :)
One reason might be that the original zipmap is 5-10 times faster for
What's up with this?
(defn zipmap
"Returns a map with the keys mapped to the corresponding vals."
[keys vals]
(loop [map {}
ks (seq keys)
vs (seq vals)]
(if (and ks vs)
(recur (assoc map (first ks) (first vs))
(next ks)
(nex