[Cs254f11] Repeat a function call

Omri Bernstein ob08 at hampshire.edu
Tue Oct 4 23:42:31 EDT 2011


Jack-

You might be looking for the function "repeatedly". As in:

(repeatedly 5 #(rand-int 20))
>> (12 18 16 11 19)

-Omri


On Tue, Oct 4, 2011 at 11:13 PM, Jack Laxson <jrl11 at hampshire.edu> wrote:

> Lee: what was the repeated function call you told us to use earlier today?
> I've managed to hit that same problem.
>
> (def initial (repeat 5 (rand-int 20))). Which repeats the random int that
> it gets. I checked the cheatsheet (http://clojure.org/cheatsheet) for the
> others but I think there was a way better way to form it.
>
> _______________________________________________
> Cs254f11 mailing list
> Cs254f11 at lists.hampshire.edu
> https://lists.hampshire.edu/mailman/listinfo/cs254f11
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.hampshire.edu/mailman/private/cs254f11/attachments/20111004/4006d6a3/attachment.htm>


More information about the Cs254f11 mailing list