[Python-Dev] Re: [Fwd: Discussion: Introducing new operators
Fri, 14 Jul 2000 09:51:59 -0700 (PDT)
> > (X'*X)\(X'*y)
> > (What does the backslash mean? What does the tick mark mean?
> > At least solve() is clear, and if i understood what H() stood
> > for, it would mean more than a tick mark.)
> More importantly, how are they grouped ? Is '* a single operator, or is ' a
> binary operator and * an unary operator ? Or is ' a postfix unary operator
> and * the binary operator ? Does the backslash escape the opening paren for
> some reason, or is it an operator on its own ?
> Oh, wait, I see it now ! It's a string literal of the new 'X' type,
> containing '*X)\(X', multiplied by y! I wonder what that 'X' type string
> is... Maybe a built-in regular expression ?
What does this mean?
s = 1.2; g = 4.4; t = 6.
a = s/2 + t/3 + 1/g
Ah, that means a is the operation that globally substitute '2' followed by
one or more space followed by ' t' with string '3 + 1'. :-)
It seems many in this list visually parse an expression in the following
order, arithmetic, structure, user defined.
However, for anyone who's done any numerical computation, matrix is part of
arithmetic, with as much justification as complex numbers (theoretically
even more justification). Whether it's user defined or built in, it has the
same precedence as arithmetic.
Imagine if users are forced to write the above as
a = add(add(div(s,2), div(t,3)), div(1,g))
to avoid confusion with regular expression! When we talk about CP4E, don't
forget math 4E. And matrix is pivotal to that goal.
As to the original expression in matlab, ' is a postfix operator and \ is an
ordinary binary operator, as in undergraduate math books.