A good example is:

  (take 10 (repeatedly #(rand-int 100)))

to get a bunch of random integers.  I actually quite like this idiom,
even if there's a bit of ascii involved :)

Mark


Tom Hicks <hickstoh...@gmail.com> writes:

> I'm not quite sure why you would want to say
>
>   (take n (repeatedly fn))
>
> It appears to me that a fn called 'repeatedly' is really
> being executed for its side-effects. If you are interested
> in a sequence of values being returned from fn, then
> make fn return a lazy sequence and 'take' will work on the
> result sequence without 'repeatedly'.
>
> Can you give us an example of how you're using 'repeatedly' with take?
>     regards,
>     -tom

-- 
Mark Triggs
<mark.h.tri...@gmail.com>

-- 
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

Reply via email to