Why is Python popular, while Lisp and Scheme aren't?

Ian Bicking ianb at colorstudy.com
Sun Nov 10 03:36:47 EST 2002


On Sun, 2002-11-10 at 01:20, Sean 'Shaleh' Perry wrote:
> What always bothers me though is the quote syntax.  '(this text) is different 
> from (this text).  I find that when reading code it is very, very easy to 
> miss that silly quote.  Sure you just learn to look for it but it is still 
> what irks me most.

I'm not sure if I'm replying to this, or just to all the Lisp syntax
issues that have been raised.  But since I've seen so many, I thought
I'd bring Logo to people's attention.

Logo (the teaching language, famous for its turtles) is very much Lisp,
but with some small changes that makes the syntax much simpler.  When
Logo is parsed, you use the arity (number of arguments) of a function to
determine the grouping.  So, given that RIGHT, LEFT, and FORWARD take
one argument, and PENUP takes none, you can parse:

  FORWARD 100 RIGHT 90 PENUP FORWARD 10

into:

  (FORWARD 100)
  (RIGHT 90)
  (PENUP)
  (FORWARD 10)

You can use parenthesis to force grouping, for instance when there's
optional arguments.  You can also use compound statements, and
essentially each function grabs as many arguments as it needs.  It also
happens to have infix operations as a sort of add-on, but you could
ignore that and Logo still has a lot of advantages (the infix can also
be confusing in terms of precedence).

The other detail is that quoted lists use [], so:

  REPEAT 100 [FORWARD 100 RIGHT 90]

is actually calling the function REPEAT (not a special form) with two
arguments, 100 and [FORWARD 100 RIGHT 90].  REPEAT could be implemented
as:

  TO REPEAT :N :EXPR
    IF :N > 1 [EVAL :EXPR REPEAT :N - 1 :EXPR]
  END

(Forgot to mention that variables have their own namespace and are
preceded with : -- this is necessary for the syntax to work as well)

The disadvantage to this is that the arity of the function needs to be
known before you can parse the statement.  Since most Logos are strictly
interpreted (not byte-compiled or anything) this isn't a problem.  A lot
of the same issues with optimization that exist for Tcl also exist for
Logo -- I actually think the languages are very similar (except Logo has
lists instead of Tcl's strings).  It also means it can be confusing,
because the reader can't parse the expression without knowledge of the
functions being used.  In that way it's vaguely like Forth...

Anyway, I think it's a novel solution to the parenthesis problem.  I
also think it's a language that deserves more attention -- in its
domain, I still think it's the most thoughtful and useful language out
there.  If Python wants to be used with the very young, it would do well
to take lessons from Logo (and Boxer, a semantically closer language
with some cool ideas).  In general Logo is a good language, though.

  Ian





More information about the Python-list mailing list