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.  In
SPAD, iterate is not supported, or at least buggy, as far as I know.  (I guess
the problem stems from the fact that 

  iterate

could be mistakenly interpreted by the compiler as the symbol 'iterate.

Thus: as Waldek pointed out, "leave" is a bad choice, so is "break" and
"iterate".  Similarly, I object to "next", and friends, since they suggest
behaviour like iterate, which is not true.

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


Martin


f(cond: Boolean): Void == 
    for i in 1..3 repeat
        if i=2 then
            output "special i"
            if cond then iterate
            output "cond is false"
        output i

g(cond: Boolean): Void == 
    for i in 1..3 repeat
        if i=2 then
            output "special i"
            if cond then "iterate"
            output "cond is false"
        output i


(45) -> f true
   Compiling function f with type Boolean -> Void 
   1
   special i
   3
                                                                   Type: Void
(46) -> g true
   Compiling function g with type Boolean -> Void 
   1
   special i
   cond is false
   2
   3
                                                                   Type: Void
(47) -> f false
   1
   special i
   cond is false
   2
   3
                                                                   Type: Void
(48) -> g false
   1
   special i
   cond is false
   2
   3
                                                                   Type: Void


-------------------------------------------------------------------------
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