On 01/09/2008 10:06 AM, Martin Rubey wrote:
> Ralf Hemmecke <[EMAIL PROTECTED]> writes:
> 
>>> No, sorry.  As far as I know, in SPAD,
>>> 
>>> => iterate            (in fact, not sure about that one)
> 
>>> => "iterate"
> 
>> So in
>> 
>> for a in list repeat (x; condition => somevalue; y)
>> 
>> somevalue is irrelevant. This form just says that y is not
>> evaluated if condition is true.
>> 
>> Clearly, in a loop all forms except "=> iterate" are confusing.

> I'm not so sure.  I think, the intention of iterate is different --
> iterate jumps to the next element of the loop, no matter in which
> block it currently is. At least, that's the semantics in Aldor, if I
> understand correctly.

Indeed. You are right. Look at the difference of the output of

---BEGIN aaa.as
#include "aldor"
#include "aldorio"
main(): () == {
        b: Integer := 0;
        for i in 1..3 repeat {
                stdout << i << "A" << newline;
                {
                        stdout << i << "B" << newline;
#if ITERATE
                        i > 1 => iterate;
#else
                        i > 1 => "iterate";
#endif
                        stdout << i << "C" << newline;
                }
                stdout << i << "D" << newline;
        }
}
main();
---END aaa.as

woodpecker:~/scratch>aldor -grun -laldor -DITERATE aaa.as
1A
1B
1C
1D
2A
2B
3A
3B
woodpecker:~/scratch>aldor -grun -laldor aaa.as
1A
1B
1C
1D
2A
2B
2D
3A
3B
3D

But clearly, the form

   => "iterate"

or

   => nil

is misleading. Better is to write:

   => "Please think carefully what happens here."

;-)

> Any other candidates for the name contest? Maybe nil? (also used
> sometimes)

I only support iterate as a keyword. Anything else is confusing, because 
one would have to give a value where none is needed.

In the example above (case "iterate") instead of

        {
                stdout << i << "B" << newline;
                i > 1 => "iterate";
                stdout << i << "C" << newline;
        }

one should rather write a not so confusing form...

        {
                stdout << i << "B" << newline;
                if not (i > 1) then stdout << i << "C" << newline;
        }

Ralf

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to