Hi Nathan, On 04.05.2009, at 15:47, Nathan Hawkins wrote:
> > On Mon, 4 May 2009 06:16:14 -0700 (PDT) > Drew Raines <aarai...@gmail.com> wrote: >> >> 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? you're not actually building a list. The function map returns a (lazy) *sequence*, which is an instance of ISeq. This just means you're getting something that supports the operations first and rest. So, since map returns a sequence and you want a Map (i.e. key/value data structure), you'll have to turn it into one by using (conj {} ...) or (into {} ...). hth, --Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---