Emilio Jesús Gallego Arias wrote:
> WRT Sloth operational behavior, what it does is simple common
> expression elimination, so for the coin case you get
>
> (coin,coin) is transformed to let M = coin in (M, M)
I see. However, the above transformation is not valid in Curry --
at least in the general case. Just replace coin in the definition
above by the Prelude function
unknown = x where x free
Now, for (unknown,unknown) you get to distinct variables, whereas
for let M = unknown in (M,M) you get only one.
> It is similar memoization, but just a hack and it doesn't work in a
> lot of cases due to eta-expansion and so on. Also it has other side
> effects, think of the infamous mono-morphism restriction.
>
> Let's think for a moment that coin could be automatically transformed
> to
>
> coin = [0,1]
>
> so then, in any sane semantics (both operational or denotational) the
> equation
>
> let x = coin in (x,x) == (coin,coin)
>
> does hold. This is the kind of treatment I'd like to have. I'm sorry I
> haven't fully developed it yet.
You could perform determinism analysis in order to apply your
transformation iff the expressions involved are determinstic.
Regards
Wolfgang
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Mi Apr 11 2007 - 11:56:08 CEST