Maybe you're in quest of http://richhickey.github.com/clojure-contrib/seq-utils-api.html#clojure.contrib.seq-utils/flatten ?
HTH, -- Laurent 2010/1/19 Scott <sbuck...@gmail.com>: > i am utilizing parenthesis to represent a tree structure within a > genetic algorithm > > I am trying to write a function that can strip all parenthesis such > that I can perform crossovers/mutations on the permutation. > > Ex. > > ( 1 2 3 4 (5 6 7 8) ((9 10 11 12)) (((13 14 15 16))) ) > > into > > ( 1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 ) > > the numbers are unique and can be in any order, and parenthesis can > occur anywhere in the representation [ another possible representation > is ( (5 6 7 8) 1 2 3 4 (((13 14 15 16))) ((9 10 11 12)) ) -- in this > case an operator must order the representation before applying the > removal of parenthesis] > > so far I hacked something like: > > (use 'clojure.contrib.str-utils) > > (defn genome-to-list [mytree] > (apply list (re-gsub #"[()]*" "" (str mytree) ) > ) > > but I am sure there is a better option via regression, any ideas? > > -- > 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