Thu, 22 Apr 1999 15:39:32 -0400
|
> X := Max(Max(Max(Max(23.0-6.5*Y,Y),Y+Z),Y-Z,Limit);
>
>I could define a 'max' operator, and put (in Prolog):
>
> X is 23.0-6.5*Y max Y max Y+Z max Y-Z max Limit,
>
>and, I think most readers will agree, this is more readable rather
than
>less: the operator says what it means; it is associative, so its
direction
>of precedence doesn't matter; it is defined, fairly naturally I
think, at a
>lower precedence than the arithmetic operators.
I would have to disagree about precedence, since I find your
expression confusing at best. The "standard" arithmetic operators have
precedence rules that are at least standard outside a software environment,
so those are read easier by a human.
Ironically, I wouldn't use either expression in anything that I
build. There are plenty of cases where function nesting becomes a bit too
complex regardless of the syntax. What ever happened to temporary
variables?
(No comments, Mike, about my "low" line of code count!)
Bill
|
|
|