From: Rahul Jain
Subject: Symbols, the Universe, and Robert Paulson or, Redefined Meanings of Symbolic Expression and their Interpretation by a Programmer
Date:
Message-ID: <878z8pwjcq.fsf@photino.sid.rice.edu>
``His name is Robert Paulson.''
If you are unfamiliar with that statement, please watch the movie
Fight Club. It's a great movie that everyone should watch anyway, and
it would be a waste to try to describe what that statement means
outside of the context of the movie.
Here is a rendition of what is happening in the movie into Lisp code:
(defpackage :real-world
(:export #:person #:person-name #:person-live-p))
(defpackage :project-mayhem)
(in-package :real-world)
(cl:defclass person ()
(live-p :initform t
:accessor person-live-p)
(name :initarg :name
:accessor person-name))
(cl:defvar robert-paulson (cl:make-instance 'person "Robert Paulson"))
(cl:assert (cl:string= (person-name robert-paulson) "Robert Paulson"))
(cl:in-package :project-mayhem)
(cl:defclass person ()
())
(in-package :real-world)
(cl:assert (cl:string= (person-name robert-paulson) "Robert Paulson"))
(cl:in-package :project-mayhem)
(cl:import '(real-world:person-name real-world:person-live-p))
(cl:defclass person ()
(live-p :initform t
:reader person-live-p))
(cl:defclass dead-person (person)
(live-p :initform nil
:allocation :class
:reader person-live-p)
(name :initform "Robert Paulson"
:allocation :class
:reader person-name))
(cl:defvar robert-paulson)
(cl:defmethod (cl:setf person-live-p) ((value null) (person person))
(cl:let ((robert-paulson person))
(cl:change-class person 'dead-person)
(cl:assert (cl:string= (person-name robert-paulson)
"Robert Paulson"))))
--
-> -/ - Rahul Jain - \- <-
-> -\ http://linux.rice.edu/~rahul -=- ············@techie.com /- <-
-> -/ "Structure is nothing if it is all you got. Skeletons spook \- <-
-> -\ people if [they] try to walk around on their own. I really /- <-
-> -/ wonder why XML does not." -- Erik Naggum, comp.lang.lisp \- <-
|--|--------|--------------|----|-------------|------|---------|-----|-|
(c)1996-2002, All rights reserved. Disclaimer available upon request.