Welcome to the CHICKEN Scheme pasting service

fact added by manumanumanu on Tue Apr 26 08:56:00 2016

(require-extension srfi-1)
(define (mem-rec-fib n)
  (define memo '(0 1 1 2 3 5 8 13))
  (define (fib c)
    (cond
     [(<= c (length memo)) (list-ref memo (- c 1))]
     [else
      (display c) (newline)
      (last (append! memo (list (+
                                (fib (- c 1))
                                (fib (- c 2))))))]))

  (fib n))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Proper ... recursion is required by the Scheme specification.
Visually impaired? Let me spell it for you (wav file) download WAV