[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

historical question about CASE

    Date: Friday, 5 June 1987  14:41-EDT
    From: Barry Margolin <barmar at Think.COM>
    To:   Sandra J Loosemore <sandra%orion at cs.utah.edu>

        Date: Fri, 5 Jun 87 11:19:20 MDT
        From: sandra%orion@cs.utah.edu (Sandra J Loosemore)

        While porting some code between CL implementations, I got bit . . .
	Does anyone remember why it was decided to treat NIL as a list
	instead of a symbol in this context?

    I don't remember specifically, but I would guess that it is for the
    benefit of macros that take a lists of things and turn them into case
    clauses.  For example:

    (defmacro do-something (thing &key allow-list ignore-list complain-list)
      `(case ,thing
         (,allow-list (frob-thing ,thing))
         (,ignore-list nil)
         (,complain-list (error "I won't frob ~S!" ,thing))))

Silly Programmer, hacks are for kids.  That's no reason.

(defmacro do-something (thing &key allow-list ignore-list complain-list)
  (append `(case ,thing)
	  (if allow-list `((,allow-list (frob-thing ,thing))))

	  .. etc ..

	-- Richard