2009/6/13 CuppoJava <patrickli_2...@hotmail.com>: > > Hi Laurent, > I like how you distilled the problem down to a reduce with an early- > exit. > > I'm interested in what you said about my suggestion: > > "using map then filter then take then count, which will > result in creating, for at least num pixels, at worst the full number > of pixels, 2 conses, and 3 times walking the array. " > > map filter and take are all lazy. so doesn't the array only get > iterated through once? by count?
Hi, Well, the array is iterated once by map, the new seq created by map is iterated once by filter, and the new seq created by filter is iterated once by count, so right, I should have written : 3 walks of seqs of the size of the array. While reduce would create no new seq, and one walk ? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---