885 B
885 B
Data Structures
These functions operate on various data structures in Keithlisp.
cons
(cons car cdr)
cons
allocates and returns a new cons with the given car
and cdr
.
car
(car cons)
car
returns the car
portion of cons
, or nil if the argument is not
a cons.
cdr
(cdr cons)
cdr
returns the cdr
portion of cons
, or nil if the argument is not
a cons.
list
(list &rest elements)
list
allocates and returns a new list containing elements
.
length
(length list)
length
returns the length of list
, or nil if it is not a valid list.
If list
is circular, length
may never return.
nth
(nth index list)
Returns the index
th element in list
. index
must be an int.
nthcdr
(nthcdr index list)
Returns the cdr of the index
th cons in list
. index
must be an int.