On Feb 18, 10:51 pm, Stuart Halloway <stuart.hallo...@gmail.com> wrote: > You are using it incorrectly. Separate returns a vector of things that > match, and a vector of things that don't match. Every time you call > the function it matches against a different random number. Take a look > at rand-elt in clojure.contrib.seq-utils.
Yes, the problem is solved by first binding the result of the random number, before applying it inside #'separate, as follows, thanks user> (let [rand-num (inc (int (rand 5)))] (separate (fn [n] (= n rand-num)) '(1 2 3 4 5))) [(4) (1 2 3 5)] > Maybe the docstring for separate should say that fn should be side- > effect-free... I concur. -- 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