Greetings,

Playing around with nested loops, for example, to iterate through a list of
cells:

    for rec(x:Xo y:Yo) in TheList do
        ...
        for rec(x:X y:Y) in {List.drop TheList @Idx} do
        ...
            TX := @Xo + @X
            TY := @Yo + @Y
        ...
        end
    end

The above code works fine since different variable names are used in each
loop. I would have thought, though, that the '!' operator would have allowed
the following usage:

    for rec(x:X y:Y) in TheList do
        ...
        for rec(x:X y:Y) in {List.drop TheList @Idx} do
        ...
            TX := @!X + @X
            TY := @!Y + @Y
        ...
        end
    end

that is, allow selective exposure of same-name outer-scope variables so that
both outer-loop and inner-loop variables could be referenced using the same
name. My attempts in using this approach have failed, so am wondering
whether I have misunderstood the use of the '!' operator, or am otherwise
doing something wrong.

Cheers,

Anthony Borla


_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to