On Tue, Jul 26, 2011 at 8:27 PM, Stephen C. Gilardi <[email protected]> wrote: > > user=> (take-while #(= (mod 20 %) 0) (apply (fn [x y] (rest (range > (max x y)))) [10 20])) > (1 2) > > but i expect to have (1 2 5 10) because of (apply (fn [x y] (rest > (range (max x y)))) [10 20]) returns (1 2 3 4 5 6 7 8 9 10 11 12 13 14 > 15 16 17 18 19) and (mod 20 5) and (mod 20 10) should give me true and > not should be dropped... > > take-while stops returning more elements as soon as the condition is false. > --Steve
The function that does what the OP seems to want is filter. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
