Name: Anonymous 2011-02-12 6:10
Fibonacci in Perl6.
Can your toy language do this?
my @fib := (0, 1, *+* ... *);Can your toy language do this?
my @fib := (0, 1, *+* ... *);
(define (Π f n m (c (processor-count)))
(let* ((t (lambda ()
(let/ec k
(do ((x n (+ x c))
(r 1 (* r (f x))))
((> x m) (k r))))))
(xs (do ((x (sub1 c) (sub1 x))
(xs '() (cons (future t) xs)))
((zero? x) xs)))
(x (t)))
(map (compose (curry apply *) touch) (cons x xs))))