Dear Meikel and Ken,
Thank you very much for your corrections and suggestions! I admit it
took a while for me to understand the more sophisticated parts of your
code, but on the way I learned quite a lot about the correct usage of
conj, assoc, update-in, and fnil!
Best regards,
Stefan
On Jan
Hi all,
I am trying to implement the function 'group-by' from Clojure.Core
using my current knowledge of Clojure but cannot get pass a
java.lang.Exception.
This is the code so far:
(defn key? [key coll]
(some #{key} (keys coll)))
(defn my-group-by [f coll]
(let [test (fn [m x]
Hi,
The exceptions stems from the call to vec. vec turns a collections
(read: seqable thing) into a vector. The right function calls is
vector.
(defn my-group-by
[f coll]
(let [test (fn [m x]
(let [res (f x)]
(if (key? res m)
(conj (m res)
On Mon, Jan 17, 2011 at 1:47 AM, Stefan Rohlfing
stefan.rohlf...@gmail.com wrote:
Hi all,
I am trying to implement the function 'group-by' from Clojure.Core
using my current knowledge of Clojure but cannot get pass a
java.lang.Exception.
This is the code so far:
(defn key? [key coll]