Re: lambda application destroys sharing

From: Sebastian Fischer <>
Date: Wed, 25 Nov 2009 18:38:53 +0100

Hi Wolfgang,

> Sorry for nitpicking.

I appreciate it.

> The transformation from the partial application ((+) (1?2)) to (\x y
> -> x + y) (1?2) happens to be valid only by virtue of the fact that
> (+) is a binary function.

Indeed. The transformation that I used is the following:

If `f e1 ... ek` is a partial application of an operation `f` of arity
`n`, then it can be transformed into the following applications of
lambda abstractions:

      (\x1 -> ... \xn -> f x1 ... xn) e1 ... ek

I believe that this is a valid transformation but would definitely be
interested in a counter example.

> If you replace (+) by the following, contrived function
> addOrSub x = (x +) ? (x -)
> the introduction of the lambda abstraction would be an invalid eta-
> expansion, i.e., (addOrSub (1?2)) and (\x y -> x `addOrSub` y) (1?2)
> are no longer equivalent.

I agree. As the arity of `addOrSub` is 1, the above transformation is
not applicable because `addOrSub (1?2)` is no partial application.

> [...] just another case that shows that beta-reduction is also not
> valid in general in a functional-logic language with compile-time
> choice.

Yikes! I understand that *eta*-reduction is invalid in a functional-
logic language with *call*-time choice. As said before, I was
surprised that *beta*-reduction (i.e. application of lambdas) is also
invalid. But I never heard the term *compile*-time choice.

Would you mind elaborating? Sorry if I'm asking to explain a joke..


Underestimating the novelty of the future is a time-honored tradition.
curry mailing list
Received on Mi Nov 25 2009 - 18:49:45 CET

This archive was generated by hypermail 2.3.0 : Do Mai 23 2024 - 07:15:10 CEST