I only need the simple way. To get a vector and to treats it as a set of key/vals. So, Jarkko's solution is what I was looking for. (apply hash-map keyvals)
On Jan 12, 5:49 pm, samppi <rbysam...@gmail.com> wrote: > Do you also want the binding to act like let's, with unpacking of > vectors and maps? > > If so, there's no public function that I know of that's set apart for > doing this—are you trying to do this in a function or a macro? If > you're creating a macro, then it's easy: just splice the binding form > into a let. But if you're creating a function (though why you would > need to, I can't imagine—since you're creating symbol bindings > anyway), I'm not sure how you would deal with it, but I'm sure there > is a way. > > But then again, if you don't want let's destructing, then as Jarkko > Oranen said, partition is probably what you want. > > On Jan 12, 4:12 am, Jarkko Oranen <chous...@gmail.com> wrote: > > > On Jan 12, 11:08 am, Gabi <bugspy...@gmail.com> wrote: > > > > What's the idiomatic Clojure way for extracting values/keys from a > > > binding form vector [key1 val1 key2 val2..] ? > > > I suppose that depends on what you want, but: > > > (apply hash-map keyvals) to make a map or > > (map first (partition 2 keyvals)) & (map second (partition 2 keyvals)) > > > -- > > Jarkko
-- 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 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