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

(atom? '()) => #t



This one just burnt me, *badly*.

Can someone explain the rationale behind treating '() as an atom?  It
seems to me that it should be a pair:  it's the empty *list* not the
empty *atom*.

Given this defn of a cons node:

struct C_node {
	struct CONS_NODE *car;
	struct CONS_NODE *cdr;
} ;

struct CONS_NODE {
	int type;

	union {
		struct C_node cdata;
		int idata;
		double fdata;
		...etc..
	} data;
} ;

#define CC	1 /* car is a PAIR, cdr is a pair */
#define CA	2 /* car is a PAIR, cdr is an atom */
#define AC	3 /* car is an ATOM, cdr is PAIR */
#define AA	4 /* car is an ATOM, cdr is an ATOM */
#define INT	5
#define	FLOAT	6 ...etc...

(note: the C means CONS, probably should be a P for PAIR)

seem to me, that the list (a b c) should be this:

   AC -> AC -> AC -> NIL
   a     b     c

but since '() is an atom, it is in actuality this:

   AC -> AC -> A A
   a     b     c NIL
-- 
Jason Coughlin ( jk0@sun.soe.clarkson.edu , jk0@clutx )
"Every jumbled pile of person has a thinking part that wonders what the
part that isn't thinking isn't thinking of." - They Might Be Giants