[racket] taking from a generator, and a possible bug

From: Richard Cleis (rcleis at me.com)
Date: Sun Aug 19 01:39:55 EDT 2012

Are you looking for something like this?

(define (tr2 k n) (build-list k (lambda (x) (random n))))
;; the x arg is unused (it counts up)

rac



On Aug 18, 2012, at 10:59 PM, Ian Tegebo wrote:

> (define (call-n-times f n)
>    (define (helper f n lst)
>      (if (< n 1)
>          lst
>          (helper f (- n 1) (cons (f) lst))))
>    (helper f n '()))
> 
> (define (take-randoms k n)
>    (call-n-times (curry random n) k))


Posted on the users mailing list.