Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

next time somebody...

111 views
Skip to first unread message

Pascal J. Bourguignon

unread,
May 19, 2013, 2:40:37 PM5/19/13
to
Next time somebody complains about parentheses or tries to implement a
parenthesisless syntax for lisp, let's have him watch
http://www.youtube.com/watch?v=y9h1oqv21Vs

--
__Pascal J. Bourguignon__

Jeff Barnett

unread,
May 19, 2013, 6:28:39 PM5/19/13
to
Pascal J. Bourguignon wrote, On 5/19/2013 12:40 PM:
> Next time somebody complains about parentheses or tries to implement a
> parenthesisless syntax for lisp, let's have him watch
> http://www.youtube.com/watch?v=y9h1oqv21Vs
>
The video is cute. However, almost the only time parentheses produce
bitches is when arithmetic is afoot. In no other case does anyone have a
clue about precedents so parentheses or equivalents such as begin/end
pairs appear. It's a silly argument unless the code is arithmetic rich.

When we were doing lots of arithmetic in our speech understanding
systems during the 1970s we put an infix reading capability into our
Lisp. You could nest infix in prefix and prefix in infix as you liked.
The only real choice a user had to make was for the default syntax for
the eval loop and file compiler.

You defined new infix operators by putting a pair of integers under the
property "BINDING-STRENGTH" of the operator symbol, where the car was
left binding strength and the cdr was right binding strength. (It was up
to you whether the read table was modified so that single character
operators split out without spaces.) New keyword operators such as BEGIN
or LOOP were defined by hanging a piece of parsing code under the
property "KEYWORD-OPERATOR". This worked quite nicely and shut everyone
up as to what they wanted to program in.

The additional implementation time for the Lisp system took maybe 4 or 5
hours to hack the system part and a day or two to actually define the
parsing routines for all of Lisp's special forms.

Jeff Barnett

Elias Mårtenson

unread,
May 19, 2013, 10:44:33 PM5/19/13
to
On Monday, 20 May 2013 02:40:37 UTC+8, informatimago wrote:
> Next time somebody complains about parentheses or tries to implement a
> parenthesisless syntax for lisp, let's have him watch
>
> http://www.youtube.com/watch?v=y9h1oqv21Vs

I watched that video earlier, and I'm a bit confused. Does kids in the US really learn that addition has higher precedence than subtraction (and the same wrt. multiplication vs. division)?

I've never heard that before, and I've always learned that mult/div and add/sub has the same precedence.

That said, I fully agree with you on what you said.

Barry Margolin

unread,
May 20, 2013, 1:28:31 AM5/20/13
to
In article <aa5b05ac-fed1-4780...@googlegroups.com>,
I was thinking the same thing. If I see

1 + 2 - 3 + 4

I just do them in order.

There's never really a problem with multiplication vs. division, because
division isn't usually written as:

5 * 3 / 4

It's done like this:

5 * 3
-----
4

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

Antsan

unread,
May 20, 2013, 5:22:06 AM5/20/13
to
4-2+3-5=4+(-2)+3+(-5)
No ambiguity left and I just cannot see how anyone would teach "addition before subtraction", given they understand the underlying mathematics. Even worse is that both "no precedence" and "subtraction before addition" give the correct result. Why use the one scheme that promises maximum surprise?

Rupert Swarbrick

unread,
May 20, 2013, 5:47:27 AM5/20/13
to
Well, "subtraction before addition" still doesn't solve the problem of
whether 1-1-1 equals -1 or 1. Coming at the question from an academic
maths background, I'd say something like

"Minus and divide are not associative. So (a-b)-c != a-(b-c) and
similarly for division. Most people use the convention that equal
precedence operations are performed from left to right, so

a-b-c means (- (- a b) c), not (- a (- b c))

However, this is always a bit confusing and can get muddled when you
start manipulating complicated expressions. As a result, in order to
make sure that everyone understands you, it's generally best to use
brackets for anything more complicated than minus signs in front of
terms of a polynomial."

Then I'd say

"And, frankly, once you've spent five minutes thinking about it
(probably some time in your early teens), you understand what's going
on and get on with your life."

Unless you have the pleasure of teaching recalcitrant school
children. In which case, you have my sympathy.

Rupert


PS: In Britain, the mnemonic seems to be "BODMAS", standing for
Brackets, Other, Division, Multiplication, Addition,
Subtraction. "Other" is exponents and anything else, apparently.
(Function application?). I suspect that addition comes before
subtraction in this scheme because it starts with a vowel.

Everyone I have asked learned the mnemonic some time after learning
to do basic arithmetic.

Barry Margolin

unread,
May 20, 2013, 10:10:38 AM5/20/13
to
In article <kncrfd$5ji$2...@speranza.aioe.org>,
Rupert Swarbrick <rswar...@gmail.com> wrote:

> Unless you have the pleasure of teaching recalcitrant school
> children. In which case, you have my sympathy.

I resemble that remark. Although the time I remember being most
recalcitrant, I was right. In an earth science class, we were learning
about parallax, and the teacher claimed that an object at N parsecs
would have a parallax of N seconds. I disagreed, and had to keep drawing
pictures on the blackboard to show that the parallax gets smaller as the
distance gets farther, this took up the whole rest of the class.
0 new messages