Subject: Re: [Edu-sig] Now I went and did it

Daniel Yoo dyoo@hkn.eecs.berkeley.edu
Sun, 8 Oct 2000 15:45:15 -0700 (PDT)


> At 04:15 PM 10/8/00 -0400, you wrote:
> >I find myself become more of an instant nutcase than testcase when I look at
> >even this trivial example:
> >
> >(define (area-of-disk r)
> >  (* 3.14 (* r r)))
> >
> >A voice inside my head starts saying "No. Stop no!"
> 
> Jason,
> I've been programming C since 1984, and my reaction is identical to yours.
> Whatever that thing is, it's not normal C/Python/Perl/fortran syntax, nor
> is it reverse polish as far as I can see. I cannot *even imagine* how a kid
> would understand that syntax. Personally, I'd feel much better if it were

I'm a Python user, but I'll try to defend Scheme in this respect, because
I really believe in Scheme's beauty.  *grin*

I think part of what feels weird is the training we have, in both our
languages and in math classes, in distinguishing between regular
functions, (sin(x), exp(e), ...) and infix operators (+, *, ...).  Many
languages make this distinction --- Scheme is one of the languages that
doesn't.

Scheme syntax makes a lot more sense when you consider everything to be a
regular function.  For example, let's rename the '*' "operator" to a
function called 'multiply':

    (define multiply *)  ;; just a renaming
    (define pi 3.14)     ;; another renaming

    (define (square r) (multiply r r))  ;; for convenience

    (define (area-of-disk r)
        (multiply pi (square r))


Also, by not making the math functions as explicitly binary infix
operators, it allows one to express:

    "multiply 2, 3, 4, and 5" 
as 
    (* 2 3 4 5)

which is pretty nice, I think.

Hopefully, this makes it a little more explicity that Scheme uniformly
treats all functions the same, even the infix math operators.