Welcome to the CHICKEN Scheme pasting service

exit in fold added by Kooda on Tue Dec 1 17:55:18 2020

(define (fold/exit pred? kons knil l . rest)
  (call/cc (lambda (return)
    (apply fold
           (lambda (o acc)
             (if (pred? acc)
                 (return acc)
                 (kons o acc)))
           knil
           l
           rest))))

;; (fold/exit zero? * 1 '(1 2 0 3 4 5 6))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Name of the language CHICKEN compiles to:
Visually impaired? Let me spell it for you (wav file) download WAV