fork download
  1. ; pentabonacci numbers
  2.  
  3. (define (iterate n f . bs)
  4. (let loop ((n n) (b (car bs)) (bs (cdr bs)) (xs '()))
  5. (if (zero? n) (reverse xs)
  6. (let ((new-bs (append bs (list (apply f b bs)))))
  7. (loop (- n 1) (car new-bs) (cdr new-bs) (cons b xs))))))
  8.  
  9. (display (iterate 30 + 0 1 1 2 4))
Success #stdin #stdout 0.01s 7908KB
stdin
Standard input is empty
stdout
(0 1 1 2 4 8 16 31 61 120 236 464 912 1793 3525 6930 13624 26784 52656 103519 203513 400096 786568 1546352 3040048 5976577 11749641 23099186 45411804 89277256)