Mark Triggs <mark.h.tri...@gmail.com> writes: > Is there an idiom for what I'm doing below, or does a function already > exist? > > (let [vowels (slice "abcdefghijklmnopqrstuvwxyz" > 0 4 8 14 20)] > vowels) > => (\a \e \i \o \u)
Here's how I would do it: (defn extract [coll & keys] (map #(get coll %) keys)) or (defn slice [coll & keys] (remove nil? (map #(get coll %) keys))) -- jan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---