Email list hosting service & mailing list manager


Typo in reference implementation of ANY erik hilsdale 07 Jan 1999 17:28 UTC

While we're on the subject...

    There's a typo in the last line of the reference implementation of
ANY  (in http://srfi.schemers.org/srfi-1/srfi-1-reference.scm).  Here's
the fixed version:

(define (any pred lis1 . lists)
  (if (pair? lists)

      ;; N-ary case
      (and (%all-pairs? lists) (pair? lis1)
	   (let lp ((heads (cons (car lis1) (%cars lists)))
		    (tails (cons (cdr lis1) (%cdrs lists))))
	     (if (%all-pairs? tails)
		 (or (apply pred heads) (lp (%cars tails) (%cdrs tails)))
		 (apply pred heads))))	; Tail-call the last PRED call.

      ;; Fast path
      (and (pair? lis1)
	   (let lp ((list lis1))	; LIST is a pair.
	     (let ((head (car list))
		   (tail (cdr list)))
	       (if (pair? tail)
		   (or (pred head) (lp tail))
		   (pred head)))))))

-erik