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

From: Shiro Kawai <shiro>
Date: Wed Nov 1 14:15:23 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
Received on Wed Nov 01 2006 - 14:16:51 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC