Hi Kevin and Raphael, Thank you. I think I understand now. Yes Kevin, it would be helpful if the tutorial explained that this is expected. Having read chapter 5 several times over, it does seem that a rewrite could make things somewhat simpler. I'll try my wand at it if I (hopefully) lose some work this winter :)
Abuzar --- Kevin Glynn <[EMAIL PROTECTED]> wrote: > > Abuzar Chaudhary writes: > > Fellow Witches, > > > > I'm ploughing my way through the tutorial. At the end of this > section: > > > > > http://www.mozart-oz.org/documentation/tutorial/node5.html#control.anonymous > > > > there exists this code: > > > > local > > Y = 1 > > in > > local > > M = f(M Y) > > [X1 !Y] = L > > L = [1 2] > > in {Browse [M L]} > > end > > end > > > > which (upon clicking oz/feed paragraph) produces this error: > > > > %********************** static analysis error ******************* > > %** > > %** equality constraint failed > > %** > > %** First value: 1 > > %** Second value: 2 > > %** Original assertion: [X1<optimized> 1] = [1 2] > > %** Offending expression in: file "Oz", line 2, column 11 > > %** in file "Oz", line 7, column 14 > > %** ------------------ rejected (1 error) > > > > Is this how the Almighty meant the world to be understood, or has > this > > lowly worthless disciple misunderstood the marvels of the > goddesses. > > > > Hi Abuzar, > > In the lines: > > [X1 !Y] = L > L = [1 2] > > X1 is fresh but (because of the exclamation mark) !Y is the same > variable as the outer Y which has already been bound to 1. > > In the second line when we try to unify [X1 1] with [1 2] we fail > because we cannot unify 1 with 2. > > So the result is correct for this program, it would be helpful if the > tutorial explained that this is expected :-( > > k --- Raphael Collet <[EMAIL PROTECTED]> wrote: > > Abuzar Chaudhary wrote: > > Fellow Witches, > > I will rather reply as a wizard, if you don't mind ;-) > > > there exists this code: > > > > local > > Y = 1 > > in > > local > > M = f(M Y) > > [X1 !Y] = L > > L = [1 2] > > in {Browse [M L]} > > end > > end > > > > which (upon clicking oz/feed paragraph) produces this error: > > Indeed. Here is the explanation: Y is not declared in the inner > 'local' > statement, but !Y correspond to the Y declared in the outer 'local'. > So > the value of L is constrained in the following inconsistent ways: > > [X1 !Y] = L % L=[_ 1] > L = [1 2] % L=[1 2] > > To make the code more consistent, one can for instance replace Y=1 by > > Y=2 in the outer 'local' declaration. > > Cheers, > > Raphael the Wizard of Well-Defined Laziness and Other ByNeed Stuff > > _________________________________________________________________________________ > mozart-users mailing list > [email protected] > http://www.mozart-oz.org/mailman/listinfo/mozart-users > __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com _________________________________________________________________________________ mozart-users mailing list [email protected] http://www.mozart-oz.org/mailman/listinfo/mozart-users
