Sunday, January 08, 2006

Reconsidering LispWorks

While reading Chapter 3 of ANSI Common Lisp (ACL) I noticed something strange. LispWorks implements union differently than Paul Graham's choice of implementation (most likely CLISP):
ACL> (union '(a b c) '(b a d))
(C B A D)

LISPWORKS> (union '(a b c) '(b a d))
(D A B C)
Common Lisp HyperSpec (CLHS) seems to allow this discrepancy:
The order of elements in the result do not have to reflect the ordering of list-1 or list-2 in any way.
Examples:
 (union '(a b c) '(f a d))
=> (A B C F D)
OR=> (B C F A D)
OR=> (D F A B C)
However, this discrepancy between Lisp implementations is confusing to a Lisp newbie like me. If simple functions (or macros?) like union behave differently, what other more significant differences exist? Graham recommends CLISP and CMUCL for free implementation but what about other implmentations like the non-free Allegro CL? If I go away from LispWorks implementation I might take a look at Jabberwocky, as commenter James McCarthy recommended.

I will attempt to ponder choice of Lisp implementation while sleeping.

[update 20060108]: Okay, I'm a doofus. Paul Graham, in the very next paragraph:
Since there is no notion of ordering in a set, these functions do not necessarily bother to preserve the order of elements found in the original lists.
So LispWorks is not deficient. In fact, Sven Van Caekenberghe's famous movie,Episode 2: (Re)writing Reddit in Lisp is 20 minutes and 100 lines, showed me how a good Lisp programmer could use LispWorks.

But I just saw Marco Baringer's "definitive" SLIME tutorial movie. It sure did inspire me to learn Emacs/SLIME.

The real question to ponder while sleeping: Go through ACL on LispWorks then learn Emacs/SLIME, or try to learn Emacs/SLIME/CommonLisp all-at-once?

0 Comments:

Post a Comment

<< Home