Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Functional programming versus imperative

Author: Tord Romstad

Date: 04:53:39 02/18/04

Go up one level in this thread


On February 18, 2004 at 06:34:56, Steven Edwards wrote:

>On February 18, 2004 at 05:21:33, Tord Romstad wrote:
>>On February 17, 2004 at 19:33:52, Vincent Diepeveen wrote:
>>
>>>Let's start the functional programming subject.
>>
>>Why?  Lisp is not a functional programming language, although it allows
>>you to write programs in a functional style if you want.  Functional
>>programming is not the only, nor even the most common style of programming
>>in Common Lisp.
>
>Generally true.  Functional programming (as opposed to imperative programming)
>certainly has some advantages like easier specification and verification.  But
>these are not as important as might be indicated by the fervor of their
>advocates (nearly all of whom first learned about Lisp directly or indirectly
>from the MIT Scheme guys).

Yes.  This is probably the main reason for the animosity towards the
Scheme community often seen among Lispers.

>Then again, I have my own fervor about avoiding
>C/C++ goto/continue/non-casebody break (and their other language equivalents).

I only partly agree here.  I think these constructs are essential as
low-level building blocks, but they should usually only be used to design
macros.

>While the Common Lisp read tables are programmable, this feature is not used
>much outside of the topic of bootstrapping other languages.  Reprogramming the
>read tables is akin to writing a boatload of C preprocessor macros to make C
>look like Pascal or some other language.

Not quite, in my opinion.  The difference is that the C preprocessor is
a language different from C.  A practical difference is of course that
such tasks tend to become very complicated and error-prone in C, while
it is much more comfortable in Lisp.

I agree that it doesn't seem to be very common to make any major
modifications to the syntax (with the exception of a few reader macros).
The main reason for this is simply that experienced Lispers learn to
appreciate the many advantages of keeping the syntax simple, and that
they don't have any difficulties reading the code.

You certainly know this, but Vincent and others possibly don't:  There
exist numerous Lisp variants with a more conventional syntax.  The most
well-known example is Dylan, which looks a bit like Pascal.  Such Lisps
have never achieved a popularity nearly as wide-spread as Common Lisp.
Most Lispers cite the lack of S-expression syntax as the main reason
they don't like Dylan and similar languages.

>>Emacs Lisp is an old, ugly and inefficient Lisp dialect, and doesn't
>>really belong in this discussion.
>
>Emacs Lisp (samples in all the *.el files in the Emacs distribution) is well
>suited for its purpose.

Yes, as an extension language for a text editor, Emacs Lisp is perfectly
usable.  But as a general-purpose programming tool it leaves a lot to
be desired.

>Emacs works remarkably fast considering its power of
>expressibility and extendibility.  It also proves false the hoary old
>misconception that "Lisp is slow".

I don't quite agree.  It is certainly fast enough for its purpose, but
if you try write a performance-intensive app (like a chess program) in
Emacs, it will be horrendously slow.  I actually think Emacs Lisp is
part of the reason for the misconception that "Lisp is slow".

>>But of course, you need a Lisp-aware editor in order to write and edit
>>Lisp code efficiently.
>
>Not really true.  Yes, Emacs works very well here, but even the simple auto
>indentation and parentheses aware features of Apple's Xcode toolkit editor
>suffice for my Lisp coding with Symbolic.

It depends on what you are used to, of course.  I am not even that fond
of Emacs for writing Lisp code.  It works well enough that I can live with
it, but I get a feeling of "working with gloves" compared to the comfort
of using MCL or the LispWorks environment.

I haven't yet tried Xcode.

Tord



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.