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

Re: Collection operations taking pseudo-predicates?



Bruce Hoult wrote:
> 
[snip]
> >
> > I wonder if a proper predicate is needed (i.e. one returning a <boolean>) or
> > a pseudo-predicate
> > ( whose result is compared against #f) is sufficient.
> >
> >
> > Anybody who can shed light on this?
> 
> This is a theoretical question?

:-) Yes.

> 
> Clearly you have the Gwydion source, which says:
> 
>   if (predicate(elem)) pair(elem, result) else result end
> 
> i.e. #f or non #f

I observed this by not looking at the implementation, but writing code like

	let sequence-without-falses = choose(identity, sequence-with-falses-inside)

and it worked.

I am interested in knowing whether above code is portable.

Cheers,


	Gabor

> 
> -- Bruce