Re: Proposal: Syntax extension

From: Sergio Antoy <antoy_at_cs.pdx.edu>
Date: Wed, 05 Jan 2011 10:56:08 -0800

On Wed, 05 Jan 2011, Michael Hanus wrote:

> Dear Colleagues,
>
> I'd like to propose two slight syntax extensions to the current definition
> of Curry that I found useful to make programs more readable
> from my practical experiences.
>
> 1. Anonymous free variables: allow anonymous variables of the form "_"
> (underscore) in arbitrary expressions. Currently, anonymous variables
> are only allowed in patterns but not as free variables in right-hand
> sides or condition of rules. This has the drawback that they
> must be explicitly declared or one has to use the Prelude
> operation "unknown". Both is not nicely readable if one has
> several unknown arguments to some operation f:
> let a,b,c,d,e free in f x a b c d e
> or
> f x unknown unknown unknown unknown unknown
> With the proposed extension, one can simply write "f x _ _ _ _ _"
> Thus, an occurrence of "_" in an expression is syntactic sugar
> for "let x free in x" (or the operation Prelude.unknown).

Yes. It is welcome and long overdue.

> 2. Non-linear patterns in function declarations: allow multiple occurences
> of a same variable in left-hand sides of function declarations.
> Such occurrences are syntactic sugar for equational constraints,
> i.e., a rule like "f x y (C x) = rhs" is syntactic sugar for
> "f x y (C z) | x=:=z = rhs" where z is a fresh variable.
> This extension avoids a restriction in Curry compared to logic programming.
> Moreover, the linearity condition does not make much sense
> in the light of other useful extensions like functional patterns.
> Finally, I don't see what is really gained by the linearity restriction.

Yes. One could also have x==z. Why is x=:=z preferred?
In true FLP there should be (almost) no residuation. But
since there is residuation in Curry, all options should be
considered and the chosen one justified.

> I am interested to get some feedback on this proposal.
>
> Best regards,
>
> Michael
> _______________________________________________
> curry mailing list
> curry_at_lists.RWTH-Aachen.DE
> http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry

Best,
Sergio
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Do Jan 06 2011 - 09:09:24 CET

This archive was generated by hypermail 2.3.0 : Do Apr 25 2024 - 07:15:11 CEST