If I needed the range to be infinite I'd probably use: (zipmap (iterate inc 1) '(a b c))
On Tue, Jun 5, 2012 at 8:13 AM, Baishampayan Ghose <b.gh...@gmail.com>wrote: > Or: (zipmap (drop 1 (range)) '(a b c)) > > :-) > > Regards, > BG > > On Tue, Jun 5, 2012 at 5:33 PM, Ambrose Bonnaire-Sergeant > <abonnaireserge...@gmail.com> wrote: > > Or: (zipmap (map inc (range)) '(a b c)) > > > > Thanks, > > Ambrose > > > > > > On Tue, Jun 5, 2012 at 8:02 PM, Jay Fields <j...@jayfields.com> wrote: > >> > >> (zipmap (range 1 4) ["a" "b" "c"]) > >> > >> > >> On Tue, Jun 5, 2012 at 7:59 AM, Christian Guimaraes > >> <cguimaraes...@gmail.com> wrote: > >>> > >>> Hello all, > >>> > >>> I'm studying a little bit of Clojure and facing a doubt here. > >>> > >>> I hava a list (a b c) and want to create a hashmap using the elements > >>> from this list. > >>> > >>> The keys will be a sequential number, and the values will be the values > >>> from the previous list. > >>> > >>> 1. list: > >>> (a b c) > >>> > >>> 2. desired hashmap: > >>> (hash-map 1 "a" 2 "b" 3 "c") > >>> > >>> How can I achieve this in a idiomatic functional way? > >>> > >>> Cheers. And thank you for your attention. > >>> > >>> -- christian > >>> > >>> -- > >>> 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 > >> > >> > >> -- > >> 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 > > > > > > -- > > 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 > > > > -- > Baishampayan Ghose > b.ghose at gmail.com > > -- > 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 > -- 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