Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21027 > unrolled thread

New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!

Started byXah Lee <xahlee@gmail.com>
First post2012-02-29 00:09 -0800
Last post2012-03-13 17:41 +0100
Articles 20 on this page of 35 — 10 participants

Back to article view | Back to comp.lang.python


Contents

  New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Xah Lee <xahlee@gmail.com> - 2012-02-29 00:09 -0800
    Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Chiron <chiron613@gmail.com> - 2012-02-29 11:43 +0000
      Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-29 07:12 -0500
      Re: New Science Discovery: Perl Detracters Remain Idiots After A Decade! Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid> - 2012-02-29 23:06 -0500
        Re: New Science Discovery: Perl Detracters Remain Idiots After A Decade! Chiron <chiron613@gmail.com> - 2012-03-01 04:52 +0000
          Re: New Science Discovery: Perl Detracters Remain Idiots After A Decade! Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid> - 2012-03-01 10:07 -0500
    Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-02-29 13:08 +0100
      Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Xah Lee <xahlee@gmail.com> - 2012-02-29 16:02 -0800
        Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-01 12:00 +0100
          Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Xah Lee <xahlee@gmail.com> - 2012-03-02 05:12 -0800
            Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-02 15:15 +0100
    Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-02-29 15:15 +0000
      Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-02-29 17:18 +0100
      Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid> - 2012-02-29 23:10 -0500
        Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af Chiron <chiron613@gmail.com> - 2012-03-01 05:07 +0000
          Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid> - 2012-03-01 10:13 -0500
            Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af Chiron <chiron613@gmail.com> - 2012-03-02 14:17 +0000
              Re: New Science Discovery: Perl Detractors Remain Idiots After A Decade! Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid> - 2012-03-02 10:53 -0500
                Re: New Science Discovery: Perl Detractors Remain Idiots After A Decade! Chiron <chiron613@gmail.com> - 2012-03-02 19:06 +0000
          Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-03-01 16:58 -0500
        Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-03-01 14:40 +0000
          Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid> - 2012-03-01 16:11 -0500
    Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! namekuseijin <namekuseijin@gmail.com> - 2012-02-29 09:45 -0800
    Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Westley Martínez <anikom15@gmail.com> - 2012-03-01 16:46 -0800
    Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Chiron <chiron613@gmail.com> - 2012-03-02 07:27 +0000
    Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-12 11:27 +0000
      Re: New Science Discovery: Perl Detractors Remain Idiots After A Decade Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid> - 2012-03-12 08:40 -0400
        Re: New Science Discovery: Perl Detractors Remain Idiots After A Decade Raymond Wiker <raw@unknown-00-23-6c-8d-9e-26.lan> - 2012-03-12 19:20 +0100
      Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-12 14:05 +0100
        Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-12 19:00 +0000
          Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-12 21:27 +0100
          Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-13 12:00 +0100
          Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-13 12:03 +0100
          Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid> - 2012-03-12 16:20 -0400
          Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade! Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-13 17:41 +0100

Page 1 of 2  [1] 2  Next page →


#21027 — New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!

FromXah Lee <xahlee@gmail.com>
Date2012-02-29 00:09 -0800
SubjectNew Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!
Message-ID<0078bbfb-5dfc-48fc-af1a-69de3cf15c3e@b1g2000yqb.googlegroups.com>
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.

Now, let me tell you what operator precedence is. First of all, let's
limit ourselfs to discuss operators that are so-called binary
operators, which, in our context, basically means single symbol
operator that takes it's left and right side as operands. Now, each
symbol have a “precedence”, or in other words, the set of operators
has a order. (one easy way to think of this is that, suppose you have
n symbols, then you give each a number, from 1 to n, as their order)
So, when 2 symbols are placed side by side such as 「3 △ 6 ▲ 5」, the
symbol with higher precedence wins. Another easy way to think of this
is that each operator has a stickiness level. The higher its level, it
more sticky it is.

the problem with the perl explanations is that it's one misleading
confusion ball. It isn't about “left/right associativity”. It isn't
about “evaluates from left to right or right to left”. Worse, the word
“associativity” is a math term that describe a property of algebra
that has nothing to do with operator precedence, yet is easily
confused with because it is a property about order of evaluation. (for
example, the addition function is associative, meaning: 「(3+6)+5 =
3+(6+5)」.)

compare it with this:

〈Perl & Python: Complex Numbers〉
http://xahlee.org/perl-python/complex_numbers.html

and for a good understanding of functions and operators, see:

〈What's Function, What's Operator?〉
http://xahlee.org/math/function_and_operators.html

[toc] | [next] | [standalone]


#21033

FromChiron <chiron613@gmail.com>
Date2012-02-29 11:43 +0000
Message-ID<ubo3r.20367$kv1.9848@newsfe03.iad>
In reply to#21027
On Wed, 29 Feb 2012 00:09:16 -0800, Xah Lee wrote:

Personally, I think this whole issue of precedence in a programming 
language is over-rated.  It seems to me that grouping of any non-trivial 
set of calculations should be done so as to remove any possible confusion 
as to intent.  It is one more obstacle to accidental errors in logic, 
where you intend one thing, possibly overlook precedence, and get a 
strange result.

Sure, mathematically it *should* go a particular way, and any programming 
language *should* follow that.  Still... they don't, and since they don't 
it makes more sense to be really obvious what you meant to do.

As someone pointed out, a programming language is for humans; computers 
don't need them.  That being the case, it makes sense to keep things as 
clear as possible.

-- 
It's OKAY -- I'm an INTELLECTUAL, too.

[toc] | [prev] | [next] | [standalone]


#21036

FromDevin Jeanpierre <jeanpierreda@gmail.com>
Date2012-02-29 07:12 -0500
Message-ID<mailman.290.1330517565.3037.python-list@python.org>
In reply to#21033
On Wed, Feb 29, 2012 at 6:43 AM, Chiron <chiron613@gmail.com> wrote:
> Personally, I think this whole issue of precedence in a programming
> language is over-rated.  It seems to me that grouping of any non-trivial
> set of calculations should be done so as to remove any possible confusion
> as to intent.

Some languages do this. e.g. all lisps.

-- Devin

[toc] | [prev] | [next] | [standalone]


#21059 — Re: New Science Discovery: Perl Detracters Remain Idiots After A Decade!

FromShmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Date2012-02-29 23:06 -0500
SubjectRe: New Science Discovery: Perl Detracters Remain Idiots After A Decade!
Message-ID<4f4ef5d2$26$fuzhry+tra$mr2ice@news.patriot.net>
In reply to#21033
In <ubo3r.20367$kv1.9848@newsfe03.iad>, on 02/29/2012
   at 11:43 AM, Chiron <chiron613@gmail.com> said:

>Sure, mathematically it *should* go a particular way,

No. Mathematically it should go the way that it is defined to go.
There is nothing in Mathematics that either requires or prohibits
infix notation in programming languages, or even in Mathematical
notation.

>it makes sense to keep things as clear as possible.

Often infix notation with well thought out precedence is the clearest
way to go. RPN and the like have their place, but often are difficult
for real people to read.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org

[toc] | [prev] | [next] | [standalone]


#21060 — Re: New Science Discovery: Perl Detracters Remain Idiots After A Decade!

FromChiron <chiron613@gmail.com>
Date2012-03-01 04:52 +0000
SubjectRe: New Science Discovery: Perl Detracters Remain Idiots After A Decade!
Message-ID<fgD3r.7862$_63.3414@newsfe19.iad>
In reply to#21059
On Wed, 29 Feb 2012 23:06:42 -0500, Shmuel (Seymour J.) Metz wrote:

> In <ubo3r.20367$kv1.9848@newsfe03.iad>, on 02/29/2012
>    at 11:43 AM, Chiron <chiron613@gmail.com> said:
> 
>>Sure, mathematically it *should* go a particular way,
> 
> No. Mathematically it should go the way that it is defined to go. There
> is nothing in Mathematics that either requires or prohibits infix
> notation in programming languages, or even in Mathematical notation.
> 
Yes.  That (the mathematically defined way) is a particular way, is it 
not?

>>it makes sense to keep things as clear as possible.
> 
> Often infix notation with well thought out precedence is the clearest
> way to go. RPN and the like have their place, but often are difficult
> for real people to read.

However, I wasn't specifically referring to infix/postfix/prefix or 
anything of that nature.  I wasn't limiting my comment to lisp notation 
in particular, since what I said applies to any language.  I was 
referring to the placement of parentheses (or other groupings) to 
indicate to *humans* what the intended sequence of events was.  The 
problem with precedence is that it is not always clear how it will go.  
Different languages have different rules, some of which depart from the 
rules in mathematics.  Some implementations of languages are buggy in 
this regard.

Mathematically, and in any language with which I am familiar, the 
sequence:  2 + 6 / 3 will yield 4.  It is unnecessary, but harmless, to 
write this as 2 + (6 / 3).  A naive reader (or just a tired or hurried 
one) might come up with 8 / 3 if there aren't any parentheses.

Whenever there is *any* possibility of ambiguity, I see no reason not to 
clarify.  Back in the days when the way you wrote your code affected how 
it was compiled, it made sense to rely heavily on language-specific 
features, thus saving a few bytes.  With gigabyte memories, gigahertz 
clock speeds, and optimizing compilers, the pressure to try to optimize 
by hand is gone.  A few extra parentheses, or even breaking down a 
complex sequence of events into discrete, simpler ones, is no longer a 
costly luxury.  A few extra variables, if they help clarity, aren't going 
to hurt anything.  Let the machine do the grunt work.  Pamper your 
readers (which in a few weeks or months might be you) and show exactly 
what you had in mind.  That's all I'm saying.

-- 
I'd just as soon kiss a Wookie.
		-- Princess Leia Organa

[toc] | [prev] | [next] | [standalone]


#21102 — Re: New Science Discovery: Perl Detracters Remain Idiots After A Decade!

FromShmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Date2012-03-01 10:07 -0500
SubjectRe: New Science Discovery: Perl Detracters Remain Idiots After A Decade!
Message-ID<4f4f90a3$38$fuzhry+tra$mr2ice@news.patriot.net>
In reply to#21060
In <fgD3r.7862$_63.3414@newsfe19.iad>, on 03/01/2012
   at 04:52 AM, Chiron <chiron613@gmail.com> said:

>Yes.  That (the mathematically defined way) is a particular way, is
>it not?

No. There is no "the mathematically defined way".

>However, I wasn't specifically referring to infix/postfix/prefix or 
>anything of that nature.  I wasn't limiting my comment to lisp
>notation in particular, since what I said applies to any language.

No, it doesn't.

>I was referring to the placement of parentheses (or other 
>groupings) to indicate to *humans* what the intended sequence 
>of events was. 

Operator precedence has the same purpose, and was around long before
computers. Quite often expressions exploiting operator precedence are
easier *for humans* to read than expressions involving deeply nested
parentheses.

>Mathematically,

Your exposure to Mathematics is too limited.

>and in any language with which I am familiar,

Your exposure to computer languages is too limited.

>the sequence:  2 + 6 / 3 will yield 4.

Try it in APL.

>Whenever there is *any* possibility of ambiguity, I see no reason
>not to clarify.

Even if doing so makes it harder to read? Since you keep referring to
Mathematics, I will point out that it is rare in Mathematics for
anybody to publish a complete proof. Minor steps are almost always
omitted to make for easier reading, and ambiguous shortcuts are used
in the expectation that the reader will understand what is meant.

>Back in the days when the way you wrote your code affected how  it
>was compiled,

That would be the present.

>it made sense to rely heavily on language-specific 
>features, thus saving a few bytes.

Those optimizations involved adding extraneous parentheses, not
omitting redundant parentheses.

>A few extra variables, if they help clarity, aren't going  to hurt 
>anything.

And if they harm clarity?

>Let the machine do the grunt work.

That's exactly what languages with operator precedence do.

>Pamper your readers (which in a few weeks or months might be you) 
>and show exactly what you had in mind.

The two goals conflict.

>That's all I'm saying.

No; you're saying to use redundant parentheses, which conflicts with
other things you're saying.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org

[toc] | [prev] | [next] | [standalone]


#21035

FromKiuhnm <kiuhnm03.4t.yahoo.it>
Date2012-02-29 13:08 +0100
Message-ID<4f4e1554$0$1385$4fafbaef@reader2.news.tin.it>
In reply to#21027
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

[toc] | [prev] | [next] | [standalone]


#21054

FromXah Lee <xahlee@gmail.com>
Date2012-02-29 16:02 -0800
Message-ID<9dc55d52-3902-4449-87e7-745fb8b911b3@n12g2000yqb.googlegroups.com>
In reply to#21035
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

[toc] | [prev] | [next] | [standalone]


#21085

FromKiuhnm <kiuhnm03.4t.yahoo.it>
Date2012-03-01 12:00 +0100
Message-ID<4f4f56c8$0$1381$4fafbaef@reader2.news.tin.it>
In reply to#21054
On 3/1/2012 1:02, Xah Lee wrote:
> 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.

They did not make up the terminology, if that is what you are saying. 
The concepts of left and right associativity are well-known and accepted 
in TCS (Theoretical CS).

If you change the terminology, no one will understand you unless you 
provide your definitions every time (and then they may not accept them).

Another way of saying that an operator is left-associative is that its 
parse tree is a left-tree, i.e. a complete tree where each right child 
is a leaf.
For instance, (use a monospaced font)
   1 + 2 + 3 + 4
gives you this left-tree:
       +
     +   4
   +   3
  1 2
while 1**2**3**4
gives you this right-tree:
   **
1    **
    2    **
        3  4

Aho, Sethi and Ullman explain it this way in "Compilers: Principles, 
Techniques and Tools":
"We say that the operator + associates to the left because an operand 
with plus signs on both sides of it is taken by the operator to its 
left. [...]"
And they also show parse trees similar to the ones I wrote above.

Kiuhnm

[toc] | [prev] | [next] | [standalone]


#21134

FromXah Lee <xahlee@gmail.com>
Date2012-03-02 05:12 -0800
Message-ID<c17131d9-ccd8-46a3-bb57-02b844faad6b@qb4g2000pbb.googlegroups.com>
In reply to#21085
On Mar 1, 3:00 am, Kiuhnm <kiuhnm03.4t.yahoo.it> wrote:
> They did not make up the terminology, if that is what you are saying.
> The concepts of left and right associativity are well-known and accepted
> in TCS (Theoretical CS).


> Aho, Sethi and Ullman explain it this way in "Compilers: Principles,
> Techniques and Tools":
> "We say that the operator + associates to the left because an operand
> with plus signs on both sides of it is taken by the operator to its
> left. [...]"
> And they also show parse trees similar to the ones I wrote above.

how do they explain when 2 operators are adjacent e.g. 「3 △ 6 ▲ 5 」?

do you happen to know some site that shows the relevant page i can
have a look?

thanks.

 Xah

On Mar 1, 3:00 am, Kiuhnm <kiuhnm03.4t.yahoo.it> wrote:
> On 3/1/2012 1:02, Xah Lee wrote:
>
> > 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.
>
> They did not make up the terminology, if that is what you are saying.
> The concepts of left and right associativity are well-known and accepted
> in TCS (Theoretical CS).
>
> If you change the terminology, no one will understand you unless you
> provide your definitions every time (and then they may not accept them).
>
> Another way of saying that an operator is left-associative is that its
> parse tree is a left-tree, i.e. a complete tree where each right child
> is a leaf.
> For instance, (use a monospaced font)
>    1 + 2 + 3 + 4
> gives you this left-tree:
>        +
>      +   4
>    +   3
>   1 2
> while 1**2**3**4
> gives you this right-tree:
>    **
> 1    **
>     2    **
>         3  4
>
> Aho, Sethi and Ullman explain it this way in "Compilers: Principles,
> Techniques and Tools":
> "We say that the operator + associates to the left because an operand
> with plus signs on both sides of it is taken by the operator to its
> left. [...]"
> And they also show parse trees similar to the ones I wrote above.
>
> Kiuhnm

[toc] | [prev] | [next] | [standalone]


#21135

FromKiuhnm <kiuhnm03.4t.yahoo.it>
Date2012-03-02 15:15 +0100
Message-ID<4f50d5ea$0$1383$4fafbaef@reader2.news.tin.it>
In reply to#21134
On 3/2/2012 14:12, Xah Lee wrote:
> On Mar 1, 3:00 am, Kiuhnm<kiuhnm03.4t.yahoo.it>  wrote:
>> They did not make up the terminology, if that is what you are saying.
>> The concepts of left and right associativity are well-known and accepted
>> in TCS (Theoretical CS).
>
>
>> Aho, Sethi and Ullman explain it this way in "Compilers: Principles,
>> Techniques and Tools":
>> "We say that the operator + associates to the left because an operand
>> with plus signs on both sides of it is taken by the operator to its
>> left. [...]"
>> And they also show parse trees similar to the ones I wrote above.
>
> how do they explain when 2 operators are adjacent e.g. 「3 △ 6 ▲ 5 」?

The same way you do, I guess. An operand that has operators on both 
sides is operand of the operator of higher precedence.
For instance, in
   3 * 4 + 6
4 is operand of * but not of +.
Indeed, the operands of + are 3*4 and 6.

> do you happen to know some site that shows the relevant page i can
> have a look?

Nope, sorry.

Kiuhnm

[toc] | [prev] | [next] | [standalone]


#21044

FromRainer Weikusat <rweikusat@mssgmbh.com>
Date2012-02-29 15:15 +0000
Message-ID<87aa41k6x5.fsf@sapphire.mobileactivedefense.com>
In reply to#21027
Xah Lee <xahlee@gmail.com> writes:
> 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.

As the perlop manpage would have told you,

	Operator associativity defines what happens if a sequence of the same
	operators is used one after another

Since this is not the case in your example, it doesn't seem to be
applicable here. Also, the Perl I'm aware doesn't have 'white
triangle' and 'black triangle' operators and it also doesn't have
operators of equal precedence and different associativity. It can't,
actually, since there would be no way to evaluate an expression like
the mock one you invented above. Lastly, that something happens to be 
in one way or another way in the completely arbitrary set of rules and
conventions commonly referred to as 'mathematics' (an essentially
outdated write-only programming language dating back to the times
when humans had to perform computations themselves) doesn't mean it is
of any relevance anywhere else just because of this, no matter how
dear it might be to lots of people.

[toc] | [prev] | [next] | [standalone]


#21046

FromKiuhnm <kiuhnm03.4t.yahoo.it>
Date2012-02-29 17:18 +0100
Message-ID<4f4e4fce$0$1386$4fafbaef@reader1.news.tin.it>
In reply to#21044
On 2/29/2012 16:15, Rainer Weikusat wrote:
> [...] 'mathematics' (an essentially
> outdated write-only programming language dating back to the times
> when humans had to perform computations themselves) [...]

Theoretical Computer Science is a branch of mathematics. Are you saying 
it is outdated?

Kiuhnm

[toc] | [prev] | [next] | [standalone]


#21058 — Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af

FromShmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Date2012-02-29 23:10 -0500
SubjectRe: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af
Message-ID<4f4ef6c8$27$fuzhry+tra$mr2ice@news.patriot.net>
In reply to#21044
In <87aa41k6x5.fsf@sapphire.mobileactivedefense.com>, on 02/29/2012
   at 03:15 PM, Rainer Weikusat <rweikusat@mssgmbh.com> said:

>'mathematics' (an essentially outdated write-only programming 
>language dating back to the times when humans had to perform 
>computations themselves) 

ROTF,LMAO! You obviously don't have a clue as to what Mathematics
means. Free hint: it doesn't mean Arithmetic. You're as bigoted as Xah
Lee,

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org

[toc] | [prev] | [next] | [standalone]


#21068 — Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af

FromChiron <chiron613@gmail.com>
Date2012-03-01 05:07 +0000
SubjectRe: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af
Message-ID<DuD3r.21706$cL.12835@newsfe17.iad>
In reply to#21058
On Wed, 29 Feb 2012 23:10:48 -0500, Shmuel (Seymour J.) Metz wrote:

> ROTF,LMAO! You obviously don't have a clue as to what Mathematics means.
> Free hint: it doesn't mean Arithmetic. You're as bigoted as Xah Lee,


Hmm... maybe, instead of just ridiculing him, you could explain where he 
is mistaken.  Of course, doing that is a *LOT* harder than just calling 
him a bigot.

BTW, I happen to agree with you insofar as this poster not understanding 
the nature of mathematics.  His comment reminds me of the article, 
"Transgressing the Boundaries: Towards a Transformative Hermeneutics of 
Quantum Gravity" (http://www.physics.nyu.edu/sokal/transgress_v2/
transgress_v2_singlefile.html).  Also known as the "Sokal Hoax."

-- 
Boling's postulate:
	If you're feeling good, don't worry.  You'll get over it.

[toc] | [prev] | [next] | [standalone]


#21101 — Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af

FromShmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Date2012-03-01 10:13 -0500
SubjectRe: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af
Message-ID<4f4f9207$39$fuzhry+tra$mr2ice@news.patriot.net>
In reply to#21068
In <DuD3r.21706$cL.12835@newsfe17.iad>, on 03/01/2012
   at 05:07 AM, Chiron <chiron613@gmail.com> said:

>Hmm... maybe, instead of just ridiculing him,

I'm treating him as he treats others.

>BTW, I happen to agree with you insofar as this poster not
>understanding  the nature of mathematics.  His comment reminds me of
>the article,  "Transgressing the Boundaries: Towards a
>Transformative Hermeneutics of Quantum Gravity" 

A brilliant piece of work. I greatly enjoyed it and the reaction to
its disclosure.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org

[toc] | [prev] | [next] | [standalone]


#21136 — Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af

FromChiron <chiron613@gmail.com>
Date2012-03-02 14:17 +0000
SubjectRe: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af
Message-ID<OD44r.17949$vo2.12949@newsfe07.iad>
In reply to#21101
On Thu, 01 Mar 2012 10:13:11 -0500, Shmuel (Seymour J.) Metz wrote:

> In <DuD3r.21706$cL.12835@newsfe17.iad>, on 03/01/2012
>    at 05:07 AM, Chiron <chiron613@gmail.com> said:
> 
>>Hmm... maybe, instead of just ridiculing him,
> 
> I'm treating him as he treats others.

OK.
> 
>>BTW, I happen to agree with you insofar as this poster not understanding
>> the nature of mathematics.  His comment reminds me of the article, 
>>"Transgressing the Boundaries: Towards a Transformative Hermeneutics of
>>Quantum Gravity"
> 
> A brilliant piece of work. I greatly enjoyed it and the reaction to its
> disclosure.

What always gets me is how so many people criticized Sokal for doing it, 
instead of soundly condemning the editor for not bothering to verify what 
Sokal said.  It's like the kid points out that the emperor has no 
clothes, so they shoot the kid.  Of course, in real life, that's exactly 
what would happen, so I guess I shouldn't be too surprised...



-- 
It is a hard matter, my fellow citizens, to argue with the belly,
since it has no ears.
		-- Marcus Porcius Cato

[toc] | [prev] | [next] | [standalone]


#21138 — Re: New Science Discovery: Perl Detractors Remain Idiots After A Decade!

FromShmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Date2012-03-02 10:53 -0500
SubjectRe: New Science Discovery: Perl Detractors Remain Idiots After A Decade!
Message-ID<4f50ecfa$2$fuzhry+tra$mr2ice@news.patriot.net>
In reply to#21136
In <OD44r.17949$vo2.12949@newsfe07.iad>, on 03/02/2012
   at 02:17 PM, Chiron <chiron613@gmail.com> said:

>What always gets me is how so many people criticized Sokal for doing
>it, 

Google for Omerta. It's common for whistle blowers to be chastised or
even persecuted. I agree that the criticism of Prof Sokal was
outrageous, but it was also predictable.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org

[toc] | [prev] | [next] | [standalone]


#21142 — Re: New Science Discovery: Perl Detractors Remain Idiots After A Decade!

FromChiron <chiron613@gmail.com>
Date2012-03-02 19:06 +0000
SubjectRe: New Science Discovery: Perl Detractors Remain Idiots After A Decade!
Message-ID<yS84r.3100$wf.2643@newsfe09.iad>
In reply to#21138
On Fri, 02 Mar 2012 10:53:30 -0500, Shmuel (Seymour J.) Metz wrote:

> In <OD44r.17949$vo2.12949@newsfe07.iad>, on 03/02/2012
>    at 02:17 PM, Chiron <chiron613@gmail.com> said:
> 
>>What always gets me is how so many people criticized Sokal for doing it,
> 
> Google for Omerta. It's common for whistle blowers to be chastised or
> even persecuted. I agree that the criticism of Prof Sokal was
> outrageous, but it was also predictable.

Yeah, omerta... I'm familiar with it.  Talk and you're dead, and they put 
a canary in your mouth (well, some folks do, anyway).

But of course you're right - it's a milder form of omerta.  It's just so 
misguided.  Kill the messenger.  Imprison the whistle-blower.



-- 
Imitation is the sincerest form of plagiarism.

[toc] | [prev] | [next] | [standalone]


#21103 — Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af

FromDevin Jeanpierre <jeanpierreda@gmail.com>
Date2012-03-01 16:58 -0500
SubjectRe: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af
Message-ID<mailman.333.1330639137.3037.python-list@python.org>
In reply to#21068
On Thu, Mar 1, 2012 at 12:07 AM, Chiron <chiron613@gmail.com> wrote:
> On Wed, 29 Feb 2012 23:10:48 -0500, Shmuel (Seymour J.) Metz wrote:
>
>> ROTF,LMAO! You obviously don't have a clue as to what Mathematics means.
>> Free hint: it doesn't mean Arithmetic. You're as bigoted as Xah Lee,
>
>
> Hmm... maybe, instead of just ridiculing him, you could explain where he
> is mistaken.  Of course, doing that is a *LOT* harder than just calling
> him a bigot.

I agree. Perhaps this is a good primer:

http://www.maa.org/devlin/LockhartsLament.pdf

-- Devin

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.python


csiph-web