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.
······@interaccess.com (Thaddeus L Olczyk) wrote in message news:<··················@nntp.interaccess.com>...
> 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
By the subject header, do you mean that you're discussing common
blunders made by Lisp programmers, or the event of Common Lisp
blundering?
;) ;) ;)
--
BPT <···@tunes.org> /"\ ASCII Ribbon Campaign
backronym for Linux: \ / No HTML or RTF in mail
Linux Is Not Unix X No MS-Word in mail
Meme plague ;) ---------> / \ Respect Open Standards