[Tutor] Ooer, OT Lisp

Bill Mill bill.mill at gmail.com
Fri Jan 21 05:08:51 CET 2005


Liam,

On Fri, 21 Jan 2005 15:46:19 +1300, Liam Clarke <cyresse at gmail.com> wrote:
> Oops,
> 
> and OT ~ Has anyone used Lisp? I've been reading Paul Graham's essays
> on how great Lisp is, and how Python is near to implementing features
> Lisp had in the 60's. Also found the concept of macros interesting.
> 
> Queries -
> 
> 1) Anyone here familiar with both?

I used Lisp at school, so my answers should be taken with a whole bag
of salt, but I kind of dug it.

> 2) If so, which would you rate as more powerful?

Lisp. No question - if it can be done, it can be done in lisp. With
that power comes a price, though - lisp is nowhere near as intuitive
as Python. Lispers won't agree (of course) but I am really and truly
convinced that it's true. At the time I learned lisp, I didn't know
too much python, so I don't think I was that biased either.

> 3) What's with all those parentheses?

They stop bothering you after a while. Use a good editor in a lisp
setting, and there's no worries. Many will highlight matching parens,
which helps out.

> 4)  Perhaps the powerful question's a bit vague, how about ease of
> use? I like that the simplest Lisp expression is - , but those
> brackets....

Once you wrap your head around lisp, it's not too hard to use. You
just have to think in a different way - recursion is good, variable
declarations are bad. Every s-expression starts with a function unless
you say otherwise.

There is no "standard" implementation of lisp, so sockets and os
access all vary by implementation. Furthermore, the docs are sketchy
and hard to read with all of the lisps I've tried. The one I liked
most was allegro common lisp (http://www.franz.com/), but I'm very far
from a power user.

> 5) Are you able to point me towards a simplified explanation of how
> the 'syntaxless' language can write programmes?
> 

Hmmm, not sure what you're getting at here. Lisp isn't syntaxless, it
just has a really simple syntax with little sugar. Here's pseudo-lisp
(no interpreter handy) for a factorial function:

(defun fact (n)
  (cond
    ((= n 0) 1)
    (t (* n (fact (- n 1))))))

Which translates into the Python:

def fact(n):
    if n == 0:
        return 1
    else:
        return n * fact(n-1)

Unless otherwise specified, everything in lisp takes the form
(function arguments); many things that are syntax in python are
functions in lisp.

Also, you should know that lisp pioneered the interactive interpreter;
python got that idea from lisp. This makes it much easer to experiment
in lisp.

> Sorry to play 20 questions.

No worries. I found the site at http://www.lisp.org/alu/home to be
very helpful when I was digging around lisp-world. If you have any
more questions, I'll try to help you out, but you might want to ask
some more knowledgeable persons.

Peace
Bill Mill
bill.mill at gmail.com


More information about the Tutor mailing list