Commit 33f03da3 authored by Nikodemus Siivola's avatar Nikodemus Siivola

ENSURE-CAR

parent 6fd2fbc5
......@@ -126,6 +126,12 @@ recommended for performance intensive use. Main usefullness as the
expected-type designator of a TYPE-ERROR."
`(satisfies circular-list-p))
(defun ensure-car (thing)
"If THING is a CONS, its CAR is returned. Otherwise THING is returned."
(if (consp thing)
(car thing)
thing))
(defun ensure-cons (cons)
"If CONS is a cons, it is returned. Otherwise returns a fresh cons with CONS
in the car, and NIL in the cdr."
......
......@@ -40,6 +40,7 @@
#:circular-list
#:circular-list-p
#:circular-tree-p
#:ensure-car
#:ensure-cons
#:ensure-list
#:lastcar
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment