On Mon, 4 May 2009 06:16:14 -0700 (PDT) Drew Raines <aarai...@gmail.com> wrote:
> > On May 4, 8:05 am, Drew Raines <aarai...@gmail.com> wrote: > > > user> (let [test-str "foo=1;bar=2;baz=3"] > > (reduce conj {} > > (map #(apply hash-map (seq (.split % "="))) > > (.split test-str ";")))) > > Whoops, that (seq) is a debugging artifact. You can remove that: > > (let [test-str "foo=1;bar=2;baz=3"] > (reduce conj {} > (map #(apply hash-map (.split % "=")) > (.split test-str ";")))) Ok, my example seems to have misled. You're missing the point a little bit: 1. I was trying to avoid the (reduce conj {} ...), by having the map function do it. Why even build a list that's only going to get thrown away when I want a hash-map at the end? 2. The functions used to split the strings were not important, only an example. It could just as easily be a function to extract fields from a java object. To some extent, I guess I'm thinking in terms of Common Lisp, where I'd build an a-list with mapcar and cons. Nathan --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---