Subject: Re: Structure interdependent slots? (newbie)
From: rpw3@rpw3.org (Rob Warnock)
Date: Wed, 21 Sep 2005 00:27:12 -0500
Newsgroups: comp.lang.lisp
Message-ID: <3tCdncw7MMOtcq3eRVn-uQ@speakeasy.net>
Joe Marshall  <jmarshall@alum.mit.edu> wrote:
+---------------
| > Make a structure describing James T. Kirk, captain of the Enterprise,
| > age 35. 
| 
| You didn't supply the ship field.  He's James T. Kirk, age 35,
| captain of nothing.
| 
| (defvar *enterprise* (make-starship :name "Enterprise"))
| (defvar *kirk* (make-captain :name "James T. Kirk"
|                              :ship *enterprise* :age 35))
+---------------

Uh...                          :STARSHIP, yes?

That said, then:

    > *kirk*
    #S(CAPTAIN
	 :NAME "James T. Kirk"
	 :AGE 35
	 :STARSHIP #S(STARSHIP
			:CAPTAIN NIL
			:NAME "Enterprise"
			:SHIELDS DOWN
			:CONDITION GREEN
			:SPEED 0))
    > 


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607