chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Question about booleans


From: Daniel Carrera
Subject: Re: [Chicken-users] Question about booleans
Date: Fri, 7 Mar 2014 16:31:47 +0100


On 7 March 2014 15:29, Peter Bex <address@hidden> wrote:
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.

Ah, yes. I should have thought of that.

 
 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?

That works. Thanks! 

Cheers,
Daniel.
--
When an engineer says that something can't be done, it's a code phrase that means it's not fun to do.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]