(car-nil-legal t)
This is a joke only afficionados of Portable Standard Lisp will understand.
This commit is contained in:
parent
dbab7651a3
commit
bf83fd3d91
|
@ -27,19 +27,25 @@
|
||||||
(if (or (symbol? x) (number? x)) 'T NIL))
|
(if (or (symbol? x) (number? x)) 'T NIL))
|
||||||
|
|
||||||
(defn CAR
|
(defn CAR
|
||||||
|
"Return the item indicated by the first pointer of a pair. NIL is treated
|
||||||
|
specially: the CAR of NIL is NIL."
|
||||||
[x]
|
[x]
|
||||||
(if
|
(cond
|
||||||
(instance? beowulf.cons_cell.ConsCell x)
|
(= x NIL) NIL
|
||||||
(.CAR x)
|
(instance? beowulf.cons_cell.ConsCell x) (.CAR x)
|
||||||
|
:else
|
||||||
(throw
|
(throw
|
||||||
(Exception.
|
(Exception.
|
||||||
(str "Cannot take CAR of `" x "` (" (.getName (.getClass x)) ")")))))
|
(str "Cannot take CAR of `" x "` (" (.getName (.getClass x)) ")")))))
|
||||||
|
|
||||||
(defn CDR
|
(defn CDR
|
||||||
|
"Return the item indicated by the second pointer of a pair. NIL is treated
|
||||||
|
specially: the CDR of NIL is NIL."
|
||||||
[x]
|
[x]
|
||||||
(if
|
(cond
|
||||||
(instance? beowulf.cons_cell.ConsCell x)
|
(= x NIL) NIL
|
||||||
(.CDR x)
|
(instance? beowulf.cons_cell.ConsCell x) (.CDR x)
|
||||||
|
:else
|
||||||
(throw
|
(throw
|
||||||
(Exception.
|
(Exception.
|
||||||
(str "Cannot take CDR of `" x "` (" (.getName (.getClass x)) ")")))))
|
(str "Cannot take CDR of `" x "` (" (.getName (.getClass x)) ")")))))
|
||||||
|
|
Loading…
Reference in a new issue