Welcome to the CHICKEN Scheme pasting service

Implementation of cumulate added by DeeEff on Fri Aug 19 00:03:25 2016

(define (cumulate proc knil s)
  (let loop ([knil knil]
             [head (car s)]
             [tail (cdr s)]
             [acc '()])
    (if (null? tail)
      (reverse (cons (proc head knil) acc))
      (let ([val (proc head knil)])
        (loop val
              (car tail)
              (cdr tail)
              (cons val acc))))))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Name of the bot in #chicken:
Visually impaired? Let me spell it for you (wav file) download WAV