stments to the values?
Thanks for your great help.
-Original Message-
From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of
Alan
Sent: Sunday, April 17, 2011 5:18 PM
To: Clojure
Subject: Re: Help with function to partition my data
Simpler still: group-by?
(g
M
To: Clojure
Subject: Re: Help with function to partition my data
Simpler still: group-by?
(group-by :a1 data) produces the result that Shoeb was looking for.
PS The original message isn't in Google's archives either.
On Apr 17, 7:54 am, Nate Austin wrote:
> I didn't s
Simpler still: group-by?
(group-by :a1 data) produces the result that Shoeb was looking for.
PS The original message isn't in Google's archives either.
On Apr 17, 7:54 am, Nate Austin wrote:
> I didn't see this original email for some reason, but here's a
> simplified version:
>
> (reduce
>
I didn't see this original email for some reason, but here's a
simplified version:
(reduce
(fn [coll {a1 :a1 :as value}] (update-in coll [a1] conj value))
{}
data)
This takes advantage of update-in passing nil if it doesn't have the
key and conj with nil returning a seq of one value.
On Su
Wrote the following function which did the trick:
(defn partn [data]
(let
[add-mapping
(fn [m v]
(assoc m v (filter #(= v (:a1 %)) data)))]
(reduce add-mapping {} (set (map #(:a1 %) data
On Sat, Apr 16, 2011 at 8:15 PM, shuaybi wrote:
> I am trying to write a functio