On Mar 10, 2010, at 12:20 PM, Glen Rubin wrote: > However, the output of my trips function yields multiple collections > of vectors inside of a larger vector. I am completely befuddled as to > how to process this behemoth.
You can merge the structure into a single list of triples by applying concat: user=> (def squares (apply concat (trips (range 1 7)))) #'user/squares user=> squares ([1 2 2.23606797749979] [1 3 3.1622776601683795] [1 4 4.123105625617661] [1 5 5.0990195135927845] [1 6 6.082762530298219] [2 3 3.605551275463989] [2 4 4.47213595499958] [2 5 5.385164807134504] [2 6 6.324555320336759] [3 4 5] [3 5 5.830951894845301] [3 6 6.708203932499369] [4 5 6.4031242374328485] [4 6 7.211102550927978] [5 6 7.810249675906654]) Then test for perfect squares with this (assuming a and b are always integers): user=> (defn perfect-square? [[a b c]] (integer? c)) #'user/perfect-square? user=> (filter perfect-square? squares) ([3 4 5]) -- 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