Wolfgang Lux on Wed, 18 Aug 2004 20:00:12 writes:
> Michael Hanus wrote:
>
> > [...] Thus, we propose
> > the name (?) instead, i.e., we like to add the following definitions
> > to the standard prelude:
> >
> > infixl 0 ?
> >
> > (?) :: a -> a -> a
> > x ? _ = x
> > _ ? y = y
> >
> >
> > Thus, the expression "1 ? 2 ? 3" non-deterministically evaluates
> > to 1, 2, or 3. Nevertheless, we are open for other suggestions.
>
> Just a minor nitpicking. It would be better to have infixr 0 ? instead
> of infixl 0 ?,
Yes. It seems more intuitive.
> since this causes less non-deterministic splitting for
> 1 ? 2 ? 3 when computing only the first solution with a search strategy.
This is probably implementation dependent.
> It is also operationally better behaved in a backtracking implementation
> like PACKS (and the interactive top-level of MCC for that matter). And,
> finally, this is also a useful hint to the users that she should prefer
> using foldr1 (?) l instead of foldl1 (?) l in order to pick one element
> non-deterministically from the list l.
>
> Regards
> Wolfgang
I am in favor.
Cheers,
Sergio
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Do Aug 19 2004 - 09:32:32 CEST