Use partition-by http://clojuredocs.org/clojure_core/clojure.core/partition-by
On Sunday, December 1, 2013 1:57:52 PM UTC-5, Ryan wrote: > > Hi all, > > I have a vector which contains an unknown number of repetitions of the > following pattern: > > String, followed by 1 or more integers > > For example: > > String > Integer > String > Integer > Integer > String > Integer > Integer > Integer > String > Integer > > What I am trying to do is to create a vector of pairs which each pair will > be the string and the integers followed. > > Real example: > > foo > 1 > bar > 10 > 20 > clown > 5 > > should convert to: > > [[foo 1] [bar 10] [bar 20] [clown 5]] > > I did try to play around with partition-by, partition and instance? but I > couldn't get it quite right. > > Thank you for your time > -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.