Re: The power difference between a macro and a function
- From: Pascal Costanza <pc@xxxxxxxxx>
- Date: Wed, 26 Oct 2005 10:14:58 +0200
Jon Harrop wrote:
anamax@xxxxxxxxxxxxx wrote:
A 7 year old learning maths can understand a lot of precedence and associativity.
When concentrating on precedence, most people can get 7-8 levels right consistently. However, "concentrating on precedence" is not a goal. In fact, said concentration is actually an obstacle. To put it another way, "understanding precedence" isn't the goal or a good thing, it is a cost/overhead/a bad thing.
You must concede that the vast majority of people choose to use associativity and precedence.
A majority uses indeed associativity and precedence. That doesn't necessarily mean that they choose to use them. It seems to me that a considerably large number of people doesn't know about prefix or postfix languages. So they can't make a choice. Another group of people reject the notion of prefix or postfix languages without having tried them, out of a gut feeling to stick with what they are used to. Of course, there are also people who tried both and indeed choose infix languages, but others make the switch.
We could all maximally bracket our mathematics to remove ambiguity but we don't because we know the expressions are much more comprehensible when written in conventional style.
I always had a tendency to maximally bracket mathematical expressions in the various infix languages I encountered because I never really understood all the precedence rules. It always seemed to me that there were strange unintuitive exceptions in those rules, and I never bothered to understand the full rules. Using parentheses always seemed to me to be the better solution that is guaranteed to be unambiguous. I think I am by far not the only one to think that way.
Admittedly there seems to be value in infix notation for mathematical expressions even if they are fully parenthesized. At least I regularly catch myself to want to use infix notation for mathematical stuff when I program in Lisp. Maybe it's just a bad habit from the old days, who knows... ;)
One can see the same thing in natural language utterances. There are many syntactically and semantically correct sentences that are too convoluted to use if one's goal is communication/understanding with people. With NL, we can't choose different rules. With computer languages we can.
Mathematics is a better analogy.
I don't think so. Lots of code I haven seen and that I write doesn't contain a lot of mathematics. What is neat about Lisp is that it allows me to write code that is closer to "natural" language than in other programming languages. (Consider the LOOP macro, for example.)
That's another reason why I think that the ray tracer code is not very representative of what is typically done in programs, at least in my experience...
Pascal
-- My website: http://p-cos.net Closer to MOP & ContextL: http://common-lisp.net/project/closer/ .
- Follow-Ups:
- Re: The power difference between a macro and a function
- From: Jon Harrop
- Re: The power difference between a macro and a function
- References:
- The power difference between a macro and a function
- From: Eyal Lotem
- Re: The power difference between a macro and a function
- From: Jon Harrop
- Re: The power difference between a macro and a function
- From: Ulrich Hobelmann
- Re: The power difference between a macro and a function
- From: Jon Harrop
- Re: The power difference between a macro and a function
- From: anamax
- Re: The power difference between a macro and a function
- From: Jon Harrop
- Re: The power difference between a macro and a function
- From: anamax
- Re: The power difference between a macro and a function
- From: Jon Harrop
- The power difference between a macro and a function
- Prev by Date: Re: "t" stands for the type true and for the boolean expression true ..
- Next by Date: Re: verbosity vs. inscrutability
- Previous by thread: Re: The power difference between a macro and a function
- Next by thread: Re: The power difference between a macro and a function
- Index(es):
Relevant Pages
|