Re: Use repeat with a function argument

2012-12-25 Thread Stuart Sierra
`repeat` takes a value and returns a sequence of that value. There's another function, `repeatedly`, which takes a function and returns a sequence of values returned by calling that function. -S -- You received this message because you are subscribed to the Google Groups Clojure group. To

Re: Use repeat with a function argument

2012-12-24 Thread Ben Wolfson
, Andrew Care wrote: I'm trying to use repeat with a function argument. This works: (reduce + (filter (fn [number] (zero? (some #{0} (map mod (take 2 (repeat 9)) [3 5] (range 1 1000))) This doesn't: (reduce + (filter (fn [number] (zero? (some #{0} (map mod (take 2 (repeat number)) [3 5

Re: Use repeat with a function argument

2012-12-24 Thread Sean Corfield
to use repeat with a function argument. This works: (reduce + (filter (fn [number] (zero? (some #{0} (map mod (take 2 (repeat 9)) [3 5] (range 1 1000))) This doesn't: (reduce + (filter (fn [number] (zero? (some #{0} (map mod (take 2 (repeat number)) [3 5] (range 1 1000))) Why can I

Re: Use repeat with a function argument

2012-12-24 Thread Marko Topolnik
(and returns 233168) Sean On Sun, Dec 23, 2012 at 11:56 PM, Marko Topolnik marko.t...@gmail.comjavascript: wrote: *repeat* is not supposed to work with functions, but there's *repeatedly. * On Monday, December 24, 2012 4:20:23 AM UTC+1, Andrew Care wrote: I'm trying to use repeat

Use repeat with a function argument

2012-12-23 Thread Andrew Care
I'm trying to use repeat with a function argument. This works: (reduce + (filter (fn [number] (zero? (some #{0} (map mod (take 2 (repeat 9)) [3 5] (range 1 1000))) This doesn't: (reduce + (filter (fn [number] (zero? (some #{0} (map mod (take 2 (repeat number)) [3 5] (range 1 1000

Re: Use repeat with a function argument

2012-12-23 Thread Meikel Brandmeyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Am 24.12.12 04:20, schrieb Andrew Care: Why can I use (repeat 9) and not (repeat number)? Because you call zero? on nil, which doesn't work. Instead of (zero? (some #{0} ...)) use (some zero? ...). Kind regards Meikel -BEGIN PGP

Re: Use repeat with a function argument

2012-12-23 Thread Marko Topolnik
*repeat* is not supposed to work with functions, but there's *repeatedly.* On Monday, December 24, 2012 4:20:23 AM UTC+1, Andrew Care wrote: I'm trying to use repeat with a function argument. This works: (reduce + (filter (fn [number] (zero? (some #{0} (map mod (take 2 (repeat 9)) [3 5