Functional syntax (Was: RE: [mercury-users] Hi, and determinism)
Mattias Waldau
mattias.waldau at tacton.se
Tue Jan 30 01:27:47 AEDT 2001
In your specific problem from ICFP you would have written
inside_sphere(Point0, Trans) :-
mag2(point_to_object_space(Trans, Point0)) =< 1.0.
instead of
inside_sphere(Point0, Trans) :-
Point = point_to_object_space(Trans, Point0),
mag2(Point) =< 1.0.
and the error would never occured.
No, I don't remember the references, but this was in the happy logic
programming days, were new LPs were invented each week.
/mattias
-----Original Message-----
From: owner-mercury-users at cs.mu.OZ.AU
[mailto:owner-mercury-users at cs.mu.OZ.AU]On Behalf Of Fergus Henderson
Sent: Monday, January 29, 2001 2:44 PM
To: mercury-users at cs.mu.OZ.AU
Subject: Re: Functional syntax (Was: RE: [mercury-users] Hi, and
determinism)
On 29-Jan-2001, Mattias Waldau <mattias.waldau at abc.se> wrote:
> As noted in previous entries, semidet can hide some variable problems.
>
> The solution is obvious: Remove the variables, and that can in many cases
be
> done by using functional syntax (even if the functions are nondet).
Well, it's not obvious to me that that is the right solution.
Firstly, you can't get rid of all of the variables in that way, so
it's not a complete solution. Secondly, using intermediate variables
is often useful for documentation purposes; it would be unfortunate
if there was a tension between using carefully named intermediate
variables to better document your code and avoiding intermediate
variables to reduce the occurrence of unintended semidet unification
problems. Thirdly, the real problem seems to be unintended semidet
unifications, not variables as such, and so I think you're attacking
it at the wrong end.
> There were some proposals like this in the eighties.
Do you have a more specific reference?
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list