Comment detail

重複無し乱数 (Nested Flatten)
Schemeの解答がなかったので投稿
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
(use srfi-1)
(use srfi-27)

(define (bingo n)
  (define (%bingo lst)
    (if (null? lst)
        '()
        (receive (head tail) (split-at lst (random-integer (length lst)))
          (cons (car tail) (%bingo (append head (cdr tail)))))))
  (%bingo (iota n 1)))

Index

Feed

Other

Link

Pathtraq

loading...