Perhaps it has something to do with the following.
Multiplication (by a nonzero integer) is repeated addition and
exponentiation (by a nonzero integer) is repeated multiplication.
So it is more natural to expand * first and interpret a*b+c as a+...+a +b
where there are b a's.
Same with ^ and * .

If a↑↑b is interpreted as a↑....↑a = a^....^a with b a's, cf. http://en.
wikipedia.org/wiki/Knuth's_up-arrow_notation than that would have precedence
over ^ as well.
In general, more up-arrows have precedence over fewer for the very same
reason: they need to be expanded first.

NB. ↑ is right associative, ie. a↑b↑c = a↑(b↑c) and is not equal to (a
↑b)↑c, which seems natural for J users.

(I you really want a mind dazzling notation, look at
http://en.wikipedia.org/wiki/Conway_chained_arrow_notation )


R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:programming-
> [email protected]] Namens Dan Bron
> Verzonden: zaterdag 31 juli 2010 17:22
> Aan: 'Programming forum'
> Onderwerp: [Jprogramming] Order of operations
>
> How did the current mathematical order of operations (PEMDAS) arise?
>
>
>
> Why does it always seem that the more powerful operators also have the
> higher precedence?  Is it so that expressions don't explode by default
> (e.g.
> 3*4^5*6 would have a very different value if * was higher precedence than
> ^).  If we introduce a new operator in the chain + * ^, would it
> necessarily
> also have the highest precedence?
>
>
>
> -Dan
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to