>
> > gives effect which is hard to do in Aldor way.
>
> Not in this case. One simply has to add "return".
>
> bar(x: Boolean, y: Boolean): String ==
> str: String := "init"
> if x then
> y => return (str := "TT")
> str := "moo" + str
> str
>
> > More precisely, Aldor has 'goto' which solves this and more general
> > problems. But ATM Spad has no 'goto', so it is hard to get the same
> > effect with Aldor semantics.
>
> I actually don't understand why SPAD has a meaning for
>
> (a; b; x => c; d) (1)
>
> and a meaning for
>
> (a; b; if u then (r; x => c; d; e); f) (2)
>
> AFAIU, in your last mail you explained that in both cases the outer
> block is left with value c.
No. The second in the second case we exit only from inner block.
The difference is between:
(a; b; if u then (r; x => c); f)
where c is last in inner block, and which exits outer block and
(a; b; if u then (r; x => c; d); f)
where there us something after c, which exits only inner block.
>
> > We can change Spad to match Aldor. However, the remark above shows
> > that to gain regularity we loose some expressive power.
>
> Either I don't understand the SPAD semantics or if it is really as I
> describe it above then I find that irregular (i.e. the meaning of =>
> depending on an if-context) and I would strongly prefer the Aldor
> semantics, i.e. (2) is equivalent to
>
> (a; b; if u then (r; if x then c else (d; e)); f)
>
> i.e. (2) ends with value f.
Yes, Spad is irregular here: if '=>' is last in the block, it
effectively is executed in surrouding block. We had problem
when '=>' was last in the function, this was because there
were no surrouding block.
--
Waldek Hebisch
[email protected]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.