Re: Language change proposal
Dear Sergio,
your proposal (restrictions R1 and R2)
for allowing free variables in the right hand
side of rules seems to be a good basis for the desired
generalization.
However, I was a bit confused by your examples.
You seem to be suggesting that the equivalent to
if-clauses in the current Curry-proposal are
where-clauses in Haskell.
>From my point of view, if-clauses correspond to
guards in Haskell. For the roots example, this
means that a Haskell-style notation would be:
roots (a,b,c)
| r1 == (-b+r)/(2*a)
&& r2 == (-b-r)/(2*a)
&& d == b^2-4*a*c
&& d >= 0
&& r == sqrt d
= (r1,r2)
(this is, of course, no valid Haskell, since Haskell does not
allow free variables (in the logic programming sense)
on the right hand side. From this point of view, Curry
subsumes Haskell already (and not the other way around))
Where-clauses are some way to introduce local definitions
(including function definitions). Such local definitions
are needed anyway (for structuring purposes)in Curry
(and should be included when
moving to a Haskell-close syntax).
The current Curry-proposal can be understood as an
intermediate language where such local definitions
have been compiled out by some kind of lambda-lifting.
When we include local (function) definitions, we
will also have to consider, whether they should be
equipped with evaluation patterns (probably yes).
A minor point:
>
> Var (ti) is contained in Var (l) union Var (sj),
> for j in 1,...,i-1 R2
>
Shouldn't this be:
Var (ti) is contained in
i-1
Var (l) U U Var (sj),
j=1 R2
Best,
Herbert
Received on Fr Dez 20 1996 - 11:32:34 CET
This archive was generated by hypermail 2.3.0
: Do Jun 20 2024 - 07:15:05 CEST