[mercury-users] Recursive lambdas

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jan 25 10:18:50 AEDT 2000


On 24-Jan-2000, Ralph Becket <rbeck at microsoft.com> wrote:
> The 0.9 compiler's just complained about the following:
> 
> ...,
> P = (pred(...) :- <<stuff which includes a recursive call to P>>)
> ...
> 
> saying that
> 
> atom.m:1275:   expected instantiatedness for non-local variables
> atom.m:1275:   of lambda goals is `ground'.
> 
> I realise this is slightly naughty in terms of the occurs check,
> but for lambdas this seems to be an entirely reasonable thing to
> want to do.
> 
> Is there a solution?

The solution is just to use a separate predicate, say `p',
rather than using a lambda expression:

		...,
		P = p(...),
		...

	p(...) :- <<stuff which includes a recursive call to p>>.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- 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
--------------------------------------------------------------------------



More information about the users mailing list