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

c*r



    From: John Foderaro <CSVAX.jkf at Berkeley>
    ...
     I always though it was ridiculous that in one of the macsyma macro 
     packages there were things like 
     (defmacro caaaaar (x) `(caaaar (car ,x))) ...

Indeed, it is truly ridiculous, but how unfortunate it is that you
did not ask an experienced lisp programmer about "why" it was ridiculous.

Just because I think it is bad to automatically support all possible c*r's
does not support your conclusion that I am proud of the fact
that macsyma contains (DEFMACRO CAADADR (X) `(CAADAR (CDR ,X))), where
a family of about 10 of these macros is defined in the macro module "MRGMAC",
which is not defaultly included in the macsyma compilation environment.
Use of these macros is only in a very few macsyma modules.

On the contrary, the few macsyma programers that used these macros
were losing badly. They avoided data abstraction at all costs!
The road to unreadable code is paved with vast nestings of Car & Cdr.

In contrast, here is something KMP defined for dealing with the
"MDO" structure in Macsyma.

 (DEFMACRO MAKE-MDO () '(LIST (LIST 'MDO) NIL NIL NIL NIL NIL NIL NIL))
 ...
 (DEFMACRO MDO-NEXT (X)   `(CAR (CDDDDR ,X)))
 (DEFMACRO MDO-THRU (X)   `(CAR (CDR (CDDDDR ,X))))
 (DEFMACRO MDO-UNLESS (X) `(CAR (CDDR (CDDDDR ,X))))

The "c*r" feature of franz encourages some of the things that give LISP
a bad name.

-gjc