Sergio Antoy wrote:
> Thanks for all the replies. So,
>
> test = 1+x ? zero x where x free
>
> is the same as
>
> test = 1+x ? zero y where x,y free
>
> Is this OK? In the first rule, x is a variable, therefore it is
> shared.
The current operational semantics (e.g., CRWL or also the big/small
step semantics in
http://www-ps.informatik.uni-kiel.de/~mh/papers/JSC05.html
does not specify any sharing over nondeterministic branches
of a computation. Thus, both are the same.
> If the two arguments of "?" are evaluated concurrently, should x
> be shared by the concurrent evaluations?
>
> If we replace "where x free" with "where x = 2+2", should 2+2
> be evaluated twice or it can be safely shared?
>
> If we replace "?" with "+", the above rules are clearly different.
>From my point of view, there is a declarative semantics that describes
the desired results of computations, like CRWL.
Sharing over nondeterministic branches is a useful optimization
that can avoid recomputations but should not change the set
of computable values. In this sense, 2+2 can be safely shared
over nondeterministic branches since this expression has the
same value in all branches, whereas a free variable
cannot be shared if it is instantiated differently in different
branches.
Best regards,
Michael
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Fr Okt 26 2007 - 16:06:34 CEST