Ralf Hemmecke wrote:
>
> > 1) declare that 'and' and 'or' are reserved only for Boolean
> > arguments, that they have short circuit semantics and
> > leave transformations in place
>
> > I admit that 1) looks most attractive for me.
>
> Same for me. and and or should be language defined and short circuit.
>
> It's also in line with Aldor.
> http://www.aldor.org/docs/HTML/chap5.html#12
>
> Thinking about it... assume "and" and "or" where not language defined
> then one could define them as
>
> (x: Boolean) and (y: Boolean): Boolean == if x then y else false;
> (x: Boolean) or (y: Boolean): Boolean == if not x then y else true;
>
> on top of
>
> false: Boolean
> true: Boolean
> not: Boolean -> Boolean
>
> But I guess "and" and "or" are too natural to be removed from the
> language definition.
Well, with definition above 'and' and 'or' would use normal
Spad evaluation rules, that is arguments would be evaluated
first, then passed to 'and'. So it is impossible to get
short circuit evaluation that way.
--
Waldek Hebisch
[email protected]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.