What can you do in LISP that you can't do in Python

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Fri May 18 10:16:38 CEST 2001


Tue, 15 May 2001 09:56:17 +0200, Alex Martelli <aleaxit at yahoo.com> pisze:

> This "normal order evaluation" more colloquially and expressively
> "lazy evaluation", has an extreme elegance, and does away with the
> need to distinguish functions from special-forms, code-blocks from
> other values, finite sequences from infinite ones, and so on.

Let me add that the main reason why many Lisp macros are expressible
as Haskell functions is not lazy evaluation but the distinction between
building a statement and executing it.

Most macro examples in this thread were involved in specifying when a
statement is executed; not in delaying evaluation of pure expressions
until their result is demanded.

In Python, as in most languages, providing arguments to a function
is combined with executing it. For parameterless functions parens do
the execution; for functions with parameters parens do two things:
specify arguments and execute.

In Haskell a statement is an expression which describes an action.
Execution of a statement doesn't happen implicitly when it's formed,
but by composing smaller statements into larger statements using
functions, operators and syntactic sugar.

Parameterization is a separate concept. For example by applying a
function to arguments you may get as a result a statement to execute.
The only purpose of applying a function is parametrization: a function
can't execute statements itself, it only transforms values to other
values. OTOH execution of a statement doesn't take arguments, only
produces a result. These two concepts are used together to express
actions depending on parameters.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list