Common Lisp Blunders 
Author Message
 Common Lisp Blunders

OK confession time.
Yesterday I fixed a bug which took me about two hours to find.
The bug was that I used the following sexp:
(append mylist (list ( list prop1 prop2 prop3)))
when what I wanted was:
(setf mylist (append mylist (list ( list prop1 prop2 prop3))))
.
I kept getting mylist was nil and fraking out because I thought
that one of the two lists should be quoted or a calculation of prop
was wrong or something else. It was only after I eliminated any other
error that I caught it.

Worse is that this is about the fourth time a similar error occured.
I'm thinking of having "did you remember to setf" in mirror image
( like "ambulance") tattooed on my forehead in a bright color. So
when I lean in to pear at code, it would reflect off the monitor, and
remind me.

This time I took the time to think out why I keep making this mistake.
The answer turns out to be very simple. In Smalltalk, most other
languages with collection classes do something like:
list append: element.
Where the actual list is appended. In list the actual list is not
modified instead a new one is returned ( a tribute to it's
"functional"ness ). I keep responding the way most languages
expect instead of the way lisp expects.

After thinking about this it occurs to me that we could have a section

in the Cookbook called "Common Lisp errors". Not errors that are
pecular to lisp, like "in this situation you should quote" ( allthough
we could have a subsection, I just think the focus should not be on
those ), but errors where the language behaves differently in a
circumstance from other languages.



Tue, 13 Jul 2004 07:45:14 GMT  
 Common Lisp Blunders

Quote:
> After thinking about this it occurs to me that we could have a section

> in the Cookbook called "Common Lisp errors".

<http://www.apl.jhu.edu/~hall/Lisp-Notes/Dalton-Pitfalls-List.text>

has a list of frequent pitfalls of new Common Lisp users. It's
probably a good starting point.

Take a look at the other learning resources at the Association of Lisp
Users site: <http://www.elwoodcorp.com/alu/>
These might also be good starting points for various sections/chapters
in a beginner's Lisp Cookbook. As someone else suggested, you should
probably contact the authors of these various resources - they may
even expand what they've done into a section or chapter, or at least
give you some editorial advice on doing so.

Raf



Tue, 13 Jul 2004 12:37:48 GMT  
 Common Lisp Blunders
By the subject header, do you mean that you're discussing common
blunders made by Lisp programmers, or the event of Common Lisp
blundering?

;) ;) ;)

--

backronym for Linux:                    \ / No HTML or RTF in mail
        Linux Is Not Unix                        X  No MS-Word in mail
Meme plague ;)   --------->          / \ Respect Open Standards



Wed, 21 Jul 2004 10:13:44 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Common CLOS Blunders (Reprise)

2. Common CLOS Blunders

3. What I want from my Common Lisp vendor and the Common Lisp community

4. lucid common lisp -- C -- Common lisp intercallability

5. Lucid (Sun) Common Lisp vs Allegro (Franz) Common Lisp - the Summary

6. Lucid (Sun) Common Lisp vs Allegro (Franz) Common Lisp

7. Sun Common Lisp vs. Allegro Common Lisp

8. New Common Lisp, Lisp-to-C translation, Lisp library for C

9. #+COMMON, #+COMMON-LISP, #+CLtL1 or #+CLtL2?

10. New Common Lisp and Lisp-to-C translator ANNOUNCEMENT

11. Running Koza's GP1 Lisp code on Common Lisp

12. How to load a lisp file in Allegro Common Lisp

 

 
Powered by phpBB® Forum Software