Steven D'Aprano <[EMAIL PROTECTED]> writes:
>
> Speaking as somebody who programmed in FORTH for a while, that doesn't
> impress me much. Prefix/postfix notation is, generally speaking, more
> of a pain in the rear end than it is worth, even if it saves you a
> tiny bit of thought when pasting code.

Of course, you use prefix notation all the time in Python:

  for x in range(0,len(y)):
    dosomething(x)

In the example, 'for,' 'range,' 'len' and 'dosomething' all use
prefix notation.  In Lisp the example might look like this, assuming the
proper functions and macros to make it work:

  (for ((x (range 0 (length y))))
     (dosomething x))

Slightly more idiomatic would be:

  (loop for x in (range 0 (length y))
        do (dosomething x))

Even more idiomatic would be:

  (loop for x below (length y)
        do (dosomething x))

Which doesn't seem particularly more or less prefixy or infixy than the
Python version.

Infix is really only used in arithmetic--and there are Lisp macros which
give one infix notation if wanted, so one could write:

  (infix 1 + x / 4)

-- 
Robert Uhl <http://public.xdi.org/=ruhl>
Give a man a fish and you feed him for a day; give him a freshly-charged
Electric Eel and chances are he won't bother you for anything ever again.
                                                --Tanuki the Raccoon-dog
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to