[r6rs-discuss] [Formal] FIND delivers an ambiguous value

Shiro Kawai shiro at lava.net
Wed Nov 1 14:16:51 EST 2006


From: Andre van Tonder <andre at het.brown.edu>
Subject: Re: [r6rs-discuss] [Formal] FIND delivers an ambiguous value
Date: Wed, 1 Nov 2006 14:07:31 -0500 (EST)

> On Wed, 1 Nov 2006, Nils M Holm wrote:
> 
> > Proposed improvement: return the tail of the sublist beginning
> > with the first member satisfying the predicate:
> 
> This is clearly the right way of doing it.  But since then
> 
>    find = memp
> 
> I would argue for dropping find altogether.

In my view, 'find' is just a convenience procedure trading
accuracy (about #f as element).   Despite of the problem
Nils pointed out, I use 'find' a lot more than 'member'-type
procedures, because most of the time I know what I'm going
to find is not #f.  I think it captures a common use case
and worth to have it.

However, if the issue really matters, another way to address
it is to make find take an optional argument, defaulted to #f,
which will be retruned in case 'find' doesn't find the item.

 (find not '(#t) 'not-found)   => not-found
 (find not '(#f) 'not-found)   => #f

--shiro



More information about the r6rs-discuss mailing list