December 04, 2002
Lisp Critic

I'm clearing my queue of stuff seen on comp.lang.lisp recently.

Chris Riesbeck's lisp critic (source is available):

? (critique
   (defun count-a (lst)
     (setq n 0)
     (dolist (x lst)
       (if (equal x 'a)
         (setq n (+ n 1))))
     n))
++++++++++
SETS-GLOBALS: GLOBALS!! Don't use global variables,
i.e., N N
++++++++++
DOLIST-SETF: Don't use SETQ inside DOLIST to accumulate
values for N.  Use DO. Make N a DO variable and don't
use SETQ etc at all.
++++++++++
USE-EQL: Unless something special is going on, use EQL,
not EQUAL.
++++++++++
X-PLUS-1: Don't use (+ N 1), use (1+ N) for its value or
(INCF N) to change N, whichever is appropriate here.
++++++++++

(Chris Riesbeck was Will Fitzgerald's thesis advisor; Will is the guy I have to thank for hiring me at two different companies to do Lisp.)

Posted by jjwiseman at December 04, 2002 10:30 AM
Comments
Post a comment
Name:


Email Address:


URL:




Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)

Comments:


Remember info?