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

bug in (ANY ... )



Procedures ANY? and ANY have a bug, at least on the zoo, in that they
will only work with unary predicates:

> (any eq? '(a b c) '(1 2 3))
** Error: wrong number of arguments to procedure
  (ANY #{Procedure 14 EQ?} (A B C) (1 2 3))

The following procedure works properly and may be used to shadow the
official T procedures:

(DEFINE (any pred? . L)
   (COND ( (null? (car L))
           nil)
         ( (apply pred? (map car L))
           T)
         (ELSE
           (apply any (cons pred? (map cdr L))) ) ) )

This problem was discovered in an attempt to use the FOR package to step
through two lists simultaneously:

> (FOR (x IN '(a b c))
       (y IN '(1 b 3))
       (UNTIL (eq? x y)) )
** Error: wrong number of arguments to procedure
  (ANY #{Procedure 16} (A B C) (1 B 3))

Any information on a more permanent solution to this problem would be
appreciated.

-Rick Mohr