Re: Proposal: restrict multiple guards

From: Wolfgang Lux <wlux_at_uni-muenster.de>
Date: Fri, 11 Apr 2003 09:52:29 +0200

Michael Hanus wrote:

> Since we agreed that adding case expressions which provide
> rigid top-down matching (without non-determinism) is useful
> (also for default rules), this is exactly what I intend to add.
> So, I guess it is compatible with the Münster Curry compiler.
> However, I have no good idea for a simple formal description.
> In order to keep the base language as it is, one could consider
> the definition
>
> swap z = case z of
> [x,y] -> [y,x]
> _ -> z
>
> as syntactic sugar for the definition
>
> swap eval rigid
> swap [] = []
> swap [x] = [x]
> swap [x,y] = [y,x]
> swap (x1:x2:x3:xs) = x1:x2:x3:xs
>
> However, describing this transformation process in detail
> is clumsy. Do you have a good suggestion?

I must admit that I don't have one, yet. May be section 3.17.3
of the Haskell report which describes the formal semantics of
pattern matching may be a starting point. It can be simplified
a bit because Curry (yet) lacks some of Haskell's features
like lazy patterns or as pattern, newtypes, or records but I
guess it will still be tedious and I haven't looked in detail
at it.

Regards
Wolfgang



_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Fr Apr 11 2003 - 10:30:23 CEST

This archive was generated by hypermail 2.3.0 : Do Feb 01 2024 - 07:15:05 CET