Subject: Re: Better Dylan syntax?
From: Erik Naggum <>
Date: 1997/09/02
Newsgroups: comp.lang.dylan,comp.lang.lisp
Message-ID: <>

* Andreas Bogk
| Maybe it's just that I've been using infix syntax ever since I've learnt
| it in school by the age of 7.  Maybe it's because I've never had a UPN
| pocket calculator.

I wonder how many Lisp programmers like RPN calculators compared to the
rest of the population.  (I don't leave home without my HP48GX, and I've
used HP calculators since a friend of my father's showed me his when I
was only an egg.)

| But
| a[7] := 3;
| is just closer to how I think than
| (aref-setter 'a 7 3) ; and I'm not even sure if this is correct
|                      ; because the syntax gives me so few hints on
|                      ; what is what

you know, a significant part of the problem with non-Lispers not liking
Lisp is that they invent such horrible "Lisp" when they don't know what it
would actually look like.  I think this is indicative of something.

your a[7] is (aref a 7) in Common Lisp.
your a[7] := x is (setf (aref a 7) x) in Common Lisp.

depending on how your multidimensional tables look, if you have any, we
have a[7][6][5] or a[7,6,5] vs (aref a 7 6 5).

| b := c * d + e * f;
| feels much more natural to me than 
| (setq b (+ (* c d) (* e f))) .
| Of course I do understand both forms, but by cultural bias I prefer
| infix.  In fact, most people do. 

for trivial examples, most people do.  I find it odd that mostly trivial
examples are shown to debunk prefix syntax.

a + b + c			(+ a b c)
a + b * 4 + c * 16		(+ a (* b 4) (* c 16))
a * (b + 4) * (c + 16)		(* a (+ b 4) (+ c 16))

a < b AND b < c			(< a b c)
a /= b AND b /= c AND a =/ c	(/= a b c)

it is also typical of infix languages to run into a terrible mess with the
precedence of operators that cause programmers to use temporary variables
in order to simplify their expressions to be readable.  also, multiline
expressions are actually frowned upon in classes because infix just gets
too complex.  it is not uncommon to find Lisp code that adds together a
bunch of values taken from nested expressions in a single form:

    (+ (foo 17)
       (bar 47 11)
       (zot 23 69))

| And if I gain nothing but a steep learning curve by switching to
| prefix, why should I?

you do in fact gain very much.  it is just hard for infix people to imagine
that prefix forms could yield more than a trivial rewrite of _their_ forms
of expression.  you won't find Lisp programmers who write (+ (+ a b) c)
just because a + b + c is really (a + b) + c, and (and (< a b) (< b c)) is
really uncommon in Lisp code even though infix folks can't hack a < b < c,
although that's precisely what they learned in their early years in school.

incidentally, reader macros are available that take infix expressions
enclosed in some special syntax (like a pair of brackets) and turn them
into prefix form for Lisp to see.  this only works for trivial arithmetic.

404 You're better off without that file.  Trust me.