Re: Language request: make key and val work on vector pairs too

2009-11-13 Thread samppi
That works, but I don't think it's satisfactory. first and second aren't the intended functions to access a map entry's keys and vals— but most importantly, it's been documented that second is very, very slow compared to val (http://w01fe.com/blog/2009/01/more-on-clojure- map-accessor-speeds/). sec

Re: Language request: make key and val work on vector pairs too

2009-11-11 Thread ataggart
Just use first and second for both cases. On Nov 11, 9:52 am, samppi wrote: > Clojure 1.1.0-alpha-SNAPSHOT > user=> (conj (first {1 2}) 3) > [1 2 3] > user=> (conj {1 2} [2 5]) > {2 5, 1 2} > user=> (key (first {1 2})) > 1 > user=> (key [1 2]) > java.lang.ClassCastException: clojure.lang.Persist