Re: apply with logicals

From: Lars Thomas Hansen <lth_at_cs.uoregon.edu>
Date: Wed, 03 Apr 1996 08:08:34 -0800

>Perhaps someone will know... Is there some good reason why this fails:
>
>STk> (apply and '(#t #t #f))
>
>*** Error:
>apply: bad procedure: #[subr and]
>
>(STk-3.0b2, Solaris-2.4, gcc-2.7.1)

This is a classic. 'And' is syntax, not a procedure. Instead, you might
want to try the every? procedure:

        (define (every? l)
          (or (null? l)
              (and (car l)
                   (every? (cdr l)))))

        (every? '(#t #t #f))

Some systems call it 'every' or 'andmap', as well. There is the obvious
converse 'some?' (some, ormap).

--lars
Received on Wed Apr 03 1996 - 18:10:58 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST