No description
Find a file
Daniel Kochmański 8e2d78a4b2 loop: destructuring: replace MAPCAR with a DO* loop
Simple MAPCAR must be replaced by a slightly more complicated DO, because the
list may not be a proper list. I want to dedicate this ballad to myself.

    This is a tale of a sorry quest
    To master pure code at the T guru's behest
    I enrolled in a class that appealing did seem
    For it promised to teach fine things like T3 and Scheme

    The first day went fine; we learned of cells
    And symbols and lists and functions as well
    Lisp I had mastered and excited was I
    For to master T3 my hackstincts did cry

    I sailed through the first week with no problems at all
    And I even said "closure" instead of "function call"
    Then said the master that ready were we
    To start real hacking instead of simple theory

    Will you, said he, write me a function please
    That in lists would associate values with keys
    I went home and turned on my trusty Apollo
    And wrote a function whose definition follows:

        (cdr (assq key a-list))

    A one-liner I thought, fool that I was
    Just two simple calls without a COND clause
    But when I tried this function to run
    CDR didn't think that NIL was much fun

    So I tried again like the good King of yore
    And of code I easily generated some more:

        (cond ((assq key a-list) => cdr))

    It got longer but purer, and it wasn't too bad
    But then COND ran out and that was quite sad

    Well, that isn't hard to fix, I was told
    Just write some more code, my son, be bold
    Being young, not even a moment did I pause
    I stifled my instincts and added a clause

        (cond ((assq key a-list) => cdr)
              (else nil))

    Sometimes this worked and sometimes it broke
    I debugged and prayed and even had a stroke
    Many a guru tried valiantly to help
    But undefined datums their efforts did squelch.

    I returneth once more to the great sage of T
    For no way out of the dilemma I could see
    He said it was easy -- more lines must I fill
    with code, for FALSE was no longer NIL.

        (let ((val (assq key a-list)))
           (cond (val (cdr val))
                 (else nil)))

    You'd think by now I might be nearing the end
    Of my ballad which seems bad things to portend
    You'd think that we could all go home scot-free
    But COND eschewed VAL; it wanted #T

    So I went back to the master and appealed once again
    I said, pardon me, but now I'm really insane
    He said, no you're not really going out of your head
    Instead of just VAL, you must use NOT NULL instead

        (let ((val (assq key a-list)))
           (cond ((not (null? val)) (cdr val))
                 (else nil)))

    My song is over and I'm going home to bed
    With this ineffable feeling that I've been misled
    And just in case my point you have missed
    Somehow I preferred (CDR (ASSQ KEY A-LIST))

                -- Ashwin Ram,
                   "A Short Ballad Dedicated to Program Growth"
2020-08-17 20:18:31 +02:00
contrib contrib: serve-event: make serve-event multithreading save 2020-06-20 16:36:32 +02:00
examples examples: add cmake example 2018-08-17 10:45:02 +02:00
msvc gc: remove unnecessary workarounds for old bdwgc versions 2020-05-10 19:47:05 +02:00
src loop: destructuring: replace MAPCAR with a DO* loop 2020-08-17 20:18:31 +02:00
.gitignore cmp: read msvc output in using the correct encoding 2020-08-02 10:55:25 +02:00
.gitlab-ci.yml Add .gitlab-ci.yml 2017-01-11 18:30:33 +00:00
appveyor.yml Add simple appveyor msvc build 2017-05-13 00:12:13 +02:00
CHANGELOG cosmetic: add noteworthy changes to the changelog 2020-06-20 16:36:32 +02:00
configure Preserve quoting when passing the arguments to the build directory 2008-08-27 09:50:44 +02:00
COPYING cosmetic: rename LGPL->COPYING 2016-10-08 14:24:31 +02:00
INSTALL fix a broken link in INSTALL, see #595 2020-06-17 08:24:55 +00:00
LICENSE copyright: add Marius to the maintainer list. 2019-02-22 18:43:37 +00:00
Makefile.in doc: set new doc as standard documentation 2019-01-03 19:14:28 +01:00
README.md update readme (typos) 2015-08-31 08:22:52 +00:00

ECL stands for Embeddable Common-Lisp. The ECL project aims to produce an implementation of the Common-Lisp language which complies to the ANSI X3J13 definition of the language.

The term embeddable refers to the fact that ECL includes a Lisp to C compiler, which produces libraries (static or dynamic) that can be called from C programs. Furthermore, ECL can produce standalone executables from Lisp code and can itself be linked to your programs as a shared library. It also features an interpreter for situations when a C compiler isn't available.

ECL supports the operating systems Linux, FreeBSD, NetBSD, DragonFly BSD, OpenBSD, Solaris (at least v. 9), Microsoft Windows (MSVC, MinGW and Cygwin) and OSX, running on top of the Intel, Sparc, Alpha, ARM and PowerPC processors. Porting to other architectures should be rather easy.