New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!
Xah Lee
xahlee at gmail.com
Wed Feb 29 19:02:39 EST 2012
i missed a point in my original post. That is, when the same operator
are adjacent. e.g. 「3 ▲ 6 ▲ 5」.
This is pointed out by Kiuhnm 〔kiuhnm03.4t.yahoo.it〕 and Tim Bradshaw.
Thanks.
though, i disagree the way they expressed it, or any sense this is
different from math.
to clarify, amend my original post, here's what's needed for binary
operator precedence:
① the symbols are ordered. (e.g. given a unique integer)
② each symbol is has either one of left-side stickness or right-side
stickness spec. (needed when adjacent symbols are the same.)
About the lisp case mentioned by Tim, e.g. in「(f a b c)」, whether it
means 「(f (f a b) c)」 or 「(f a (f b c))」 . It is not directly relevant
to the context of my original post, because it isn't about to
operators. It's about function argument eval order. Good point,
nevertheless.
the perl doc, is still misleading, terribly bad written. Becha ass!
Xah
On Feb 29, 4:08 am, Kiuhnm <kiuhnm03.4t.yahoo.it> wrote:
> On 2/29/2012 9:09, Xah Lee wrote:
>
>
> > New Science Discovery: Perl Idiots Remain Idiots After A Decade!
>
> > A excerpt from the new book 〈Modern Perl〉, just published, chapter 4
> > on “Operators”. Quote:
>
> > «The associativity of an operator governs whether it evaluates from
> > left to right or right to left. Addition is left associative, such
> > that 2 + 3 + 4 evaluates 2 + 3 first, then adds 4 to the result.
> > Exponentiation is right associative, such that 2 ** 3 ** 4 evaluates 3
> > ** 4 first, then raises 2 to the 81st power. »
>
> > LOL. Looks like the perl folks haven't changed. Fundamentals of
> > serious math got botched so badly.
>
> > Let me explain the idiocy.
>
> > It says “The associativity of an operator governs whether it evaluates
> > from left to right or right to left.”. Ok, so let's say we have 2
> > operators: a white triangle △ and a black triangle ▲. Now, by the
> > perl's teaching above, let's suppose the white triangle is “right
> > associative” and the black triangle is “left associative”. Now, look
> > at this:
>
> > 3 △ 6 ▲ 5
>
> > seems like the white and black triangles are going to draw a pistol
> > and fight for the chick 6 there. LOL.
>
> Sorry, but you're wrong and they're right.
> Associativity governs the order of evaluation of a group of operators
> *OF THE SAME PRECEDENCE*.
> If you write
> 2**3**4
> only the fact the '**' is right associative will tell you that the order is
> 2**(3**4)
> and not
> (2**3)**4
> I remind you that 2^(3^4) != (2^3)^4.
>
> Kiuhnm
More information about the Python-list
mailing list