[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Typo in reference implementation of ANY

This page is part of the web mail archives of SRFI 1 from before July 7th, 2015. The new archives for SRFI 1 contain all messages, not just those from before July 7th, 2015.



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