chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Correct behavior of SRFI-1 any


From: Nick Zarr
Subject: Re: [Chicken-users] Correct behavior of SRFI-1 any
Date: Tue, 29 Nov 2011 06:14:42 -0600

On Tue, Nov 29, 2011 at 12:05 AM, John Cowan <address@hidden> wrote:
Nick Zarr scripsit:

> I'm writing an implementation of SRFI-1 in _javascript_ (just for fun) and I
> have a question about SRFI-1's any procedure.  In the docs it says that
> "(any) does not return a simple boolean (#t or #f), but a general value",
> however it also says that any must be called with a "procedure taking n
> arguments and returning a boolean result".

The latter is clearly in error: the predicate argument to ANY, EVERY,
and LIST-INDEX can return any value.  The words "and returning a boolean
result" should be removed from the specification.

No, that's the difference between ANY and FIND.  FIND returns the
element which satisfies the predicate, whereas ANY returns what the
predicate returns, in this case (void), because that is a true value.
Chicken is doing the Right Thing.

Thanks.  After reading the spec quite a few times and becoming more confused, it slipped my mind that (if (even? x) x) would return (void) and that it was a true value.  I assumed that Chicken was doing the right thing, thanks to you and Jim for pointing out my error!

--
Nick Zarczynski
Rent a Geek IT Services
Blog 4


reply via email to

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