|
From: | Daniel Carrera |
Subject: | Re: [Chicken-users] Question about booleans |
Date: | Fri, 7 Mar 2014 16:31:47 +0100 |
On Fri, Mar 07, 2014 at 02:42:00PM +0100, Daniel Carrera wrote:
> I'm confused. Is "and" defined as a macro? If so, why?
Yes, because it needs to be short-cutting evaluation when it
hits the first #f. Otherwise (and #f (error "foo")) would
raise the error due to the fact that evaluation of arguments
happens before function invocation.
If you want to use and in
a fold operation, you will be invoking it for each element in
the list even if it returns #f after the first. Maybe "every"
from srfi-1 is what you're looking for?
[Prev in Thread] | Current Thread | [Next in Thread] |