From: Rahul Jain
Subject: Symbols, the Universe, and Robert Paulson or, Redefined Meanings of Symbolic Expression and their Interpretation by a Programmer
Newsgroups: comp.lang.lisp
Organization: Rice University, Houston TX
“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”))))
No comments yet.