Python syntax in Lisp and Scheme

Marco Antoniotti marcoxa at cs.nyu.edu
Wed Oct 8 13:38:19 EDT 2003


Dirk Thierbach wrote:

> james anderson <james.anderson at setf.de> wrote:
> 
>>Matthias Blume wrote:
> 
> 
>>>Most of the things that macros can do can be done with HOFs with just
>>>as little source code duplication as with macros.  (And with macros
>>>only the source code does not get duplicated, the same not being true
>>>for compiled code.  With HOFs even executable code duplication is
>>>often avoided -- depending on compiler technology.)
> 
> 
>>is the no advantage to being able to do either - or both - as the
>>occasion dictates?
> 
> 
> I can't parse this sentence, but of course you can also use HOFs in Lisp
> (all flavours). The interesting part is that most Lisp'ers don't seem
> to use them, or even to know that you can use them, and use macros instead.
> 
> The only real advantage of macros over HOFs is that macros are guaranteed
> to to executed at compile time. A good optimizing compiler (like GHC
> for Haskell) might actually also evaluate some expressions including
> HOFs at compile time, but you have no control over that. 
> 
> 
>>i'd be interested to read examples of things which are better done
>>with HOF features which are not available in CL.
> 
> 
> HOFs can of course be used directly in CL, and you can use macros to
> do everything one could use HOFs for (if you really want).
> 
> The advantage of HOFs over macros is simplicity:

As R^nRS shows, simplicity leads to language specs without useful things 
(like records/struct) in them.

You want to make things simple, not any simpler (was it Einstein who 
said that?)

> You don't need additional
> language constructs (which may be different even for different Lisp
> dialects, say), 

As we well know, there is now one dominant Lisp, which is Common by 
name.  (No.  ELisp does not count as you do (require 'cl) in your .emacs 
file)  This argument is moot.

> and other tools (like type checking) are available for
> free;

Yes.  Type Checking is in CMUCL/SBCL.

> and the programmer doesn't need to learn an additional concept.

The programmer needs to learn to use the tool at its best.  If your tool 
is limited you just have to learn less.

Cheers
--
Marco





More information about the Python-list mailing list