Welcome to the CHICKEN Scheme pasting service

find-map added by DerGuteMoritz on Mon Sep 12 16:01:07 2011

(define (find-map proc lst . lists)
  (let loop ((lists (cons lst lists)))
    (and (not (any null? lists))
         (or (apply proc (map car lists))
             (loop (map cdr lists))))))


#;52> (find-map (lambda (x) (alist-ref 'bar x)) '(((foo . 1)) ((bar . 2))))
2
#;53> (find-map (lambda (x) (x)) (list (constantly #f) (constantly #f) (constantly 'hey)))
hey

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which module provides `string-intersperse'?
Visually impaired? Let me spell it for you (wav file) download WAV