Re: Can I use reduce here?

2014-12-12 Thread Jarrod Swart
Mathias, I wrote a short article about building more complex reduce functions here[1]. I wrote it mostly to reinforce my own knowledge. The bottom section will be most relevant to you. Hope it helps, Jarrod [1]: http://jarrodswart.com/articles/clojure-tutorial-reduce-functions On Friday, De

Re: Can I use reduce here?

2014-12-12 Thread Robin Heggelund Hansen
Wow, I made a lot of mistakes. It should of course reduce into [] (not {}) and then it should be "conj" instead of "assoc". I also made several spelling mistakes... Should probably sleep more I guess :P kl. 11:57:00 UTC+1 fredag 12. desember 2014 skrev Mathias Picker følgende: > > Hi Robin, >

Re: Can I use reduce here?

2014-12-12 Thread Mathias Picker
Hi Robin, thanks for the example of reduce above! That was what I was looking for. I will try it out once I'm at my desk again. / Mathias -- 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

Re: Can I use reduce here?

2014-12-12 Thread Robin Heggelund Hansen
If you want to turn the CSV text into a string, you can either find CSV decoders, or take a look at "split-with" kl. 11:07:58 UTC+1 fredag 12. desember 2014 skrev Mathias Picker følgende: > > Hi all, > > a short question from a newbie. I have a data structure like: > > "mytitle1"; "2015-02-01" >

Re: Can I use reduce here?

2014-12-12 Thread Robin Heggelund Hansen
(def sample ["mytitle1" "2015-02-01" "mytitle"" "2015-03-12" "" "2015-03-28" "mytitle3" "2015-01-12"]) ;; Turns the map above into a map, skip this if you already have a map (def working-set (-> sample (partition 2) ;;

Can I use reduce here?

2014-12-12 Thread Mathias Picker
Hi all, a short question from a newbie. I have a data structure like: "mytitle1"; "2015-02-01" "mytitle2"; "2015-03-12" "";2015-03-28" "mytitle3; "2015-01-12" and want something like this [{:title "mytitle1" :events [{:date "2015-02-01}]} {:title "mytitle2" :events [{:date "2015-03-12"} {:date