RE: Help with function to partition my data

2011-04-17 Thread Bhinderwala, Shoeb
I wasn't aware of the group-by function. Being new to clojure, I spent hours coming up with my complex function. Seeing the one line solution really blew me away. Thanks!! Follow up questions on my problem (my code again first): ;data is a list of records (maps) (def data '({:a1 2 :a2 34 :a3 76 :

Re: Open Source Projects for Beg/ Intermediate

2011-04-17 Thread Phil Hagelberg
On Apr 16, 5:43 pm, Sam Aaron wrote: > It feels to me that in addition to asking which open source projects would be > useful/beneficial for novices to hack on, it would be useful to have a list > of open source projects that are useful/beneficial for novices to read and > understand. Possibly

Re: def and ;dynamic

2011-04-17 Thread Stuart Sierra
1.3 is not even beta yet, so still a long way from "final." In the latest snapshots, :dynamic is no longer added automatically, but it still prints a warning. -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

Re: Clojure 1.2.1 download?

2011-04-17 Thread Stuart Sierra
It will get there eventually... -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe f

Re: Help with function to partition my data

2011-04-17 Thread Alan
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 >  

Re: Open Source Projects for Beg/ Intermediate

2011-04-17 Thread Sean Corfield
On Sun, Apr 17, 2011 at 1:34 AM, Ulises wrote: > I've started doing exactly what you did: double coding at work. And > that has kept me going for a while. Just as you said, because I didn't > have to learn 2 things (the domain and the language) I could > concentrate on one (the language) and hence

Understanding the Clojure source-code and functionality

2011-04-17 Thread Terje Dahl
I would very much like to study and understand how Clojure works "under the hood". Yes, I have downloaded the source and looked at it. Yes, I have all the books about programming in Clojure. But what I am looking for is learning and understanding how the Clojure JVM-code actually works. And how i

Re: Help with function to partition my data

2011-04-17 Thread Nate Austin
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

Re: Open Source Projects for Beg/ Intermediate

2011-04-17 Thread Ambrose Bonnaire-Sergeant
On Sun, Apr 17, 2011 at 9:37 PM, Carin Meier wrote: > > > Other areas that I have an interest in right now is the Semantic Web. > There is a vast amount of data out there out on dbPedia. Tapping into > it and integrating to other sites/ services (like twitter) would be > quite exciting. > > Check

Re: Open Source Projects for Beg/ Intermediate

2011-04-17 Thread Carin Meier
I would second this. On Apr 16, 8:43 pm, Sam Aaron wrote: > It feels to me that in addition to asking which open source projects would be > useful/beneficial for novices to hack on, it would be useful to have a list > of open source projects that are useful/beneficial for novices to read and >

Re: Open Source Projects for Beg/ Intermediate

2011-04-17 Thread Carin Meier
First, much thanks to everyone for the feedback and suggestions. It really helps. One of my interests is sharing my enthusiasm for Clojure by exposing it in an accessible, educational and fun way to developers. From this standpoint, the 4clojure project is very interesting to me. Clojars makes

Re: Help with function to partition my data

2011-04-17 Thread Shoeb Bhinderwala
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

Re: seeking memoize that evaluates wrapped function at most once for any given arguments

2011-04-17 Thread Meikel Brandmeyer
Hi, you find such a memoize here: http://kotka.de/blog/2010/03/memoize_done_right.html. It's based on an old discussion thread of memoize here on the group. Then there is cache-dot-clj, which is based on the above: https://github.com/alienscience/cache-dot-clj. Hope that helps. Sincerely Meikel

seeking memoize that evaluates wrapped function at most once for any given arguments

2011-04-17 Thread B Smith-Mannschott
I noticed recently that clojure.core/memoize does not promise that memoized calls will occur only once in the presence of multiple threads. i.e: user=> (dorun (map (memoize (fn [x] (Thread/sleep 1000) (print x))) (repeat 10 1))) 1nil However: user=> (dorun (pmap (memoize (fn [x] (Thread/sleep 10

Re: Open Source Projects for Beg/ Intermediate

2011-04-17 Thread Ulises
> So, questions to Carin, Alex and Alan (and Ulises): What interests > you? What problems do you have that you'd like solutions for? Knowing > that, folks might be able to point you at existing projects to take > part in (or might confirm no such project exists and they'd be > interested in collabo

Re: using clojure for (java) code generation; advice sought

2011-04-17 Thread Ilia Ablamonov
Hello! Fleet have parameters for sure :) Creating template from string: (fleet [post] "<(post :body)>") returns function of single argument post. (fleet [post, comments] "<(post :body)> <(comments :count)>") returns function of two arguments post, comments. Creating multiple templates from dir: