Re: prelude extension proposal

From: Sebastian Fischer <sebf_at_informatik.uni-kiel.de>
Date: Tue, 11 Oct 2005 09:27:21 +0200

Sergio Antoy wrote:
> I'd like to propose to extend the prelude with the following functions
>
> The first one is a simple convenience, particularly because the
> command line interpreter does not accept lambda expressions.
>
> allValuesOf e = findall (\x -> x=:=e)

indeed this can be written without any lambdas:

allValuesOf e = findall (e=:=)

or

allValuesOf = findall . (=:=)

but I also think, this function is convenient - the authors of
AllSolutions.curry think so too and provide an IO action

getAllValues :: a -> IO [a]

> The second one serves the same purpose as the prelude function
> until, but for constrains instead of booleans.
>
> cuntil f x = case allValuesOf (f x) of
> [] -> x
> (r:_) -> cuntil f r

this would be a nice extension, although I think the name is a bit
misleading: "until" stops when the given boolean predicate holds, and
"cuntil" continues while the condition holds. Maybe we should call it
cwhile then?

Best wishes,
Sebastian

_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Mi Okt 12 2005 - 09:57:09 CEST

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:07 CEST