1.4.8 Lists
List functions can also be found in the sections on Association Lists,
Sets, and Sequences.
Creates a new pair containing x and y.
Returns true when x is a pair.
Returns the first element of a
cons-pair, or
nil for
nil.
Returns the second element of a
cons-pair, or
nil for
nil.
Concatenates all the elements in the given lists into one list. This a macro
that expands into calls of the function
binary-append.
Concatenates two lists. Returns a new list containing all the items from
x followed by all the items from y.
Examples: |
> (binary-append (list 1 2 3) (list 4 5 6)) | '(1 2 3 4 5 6) | > (binary-append (list 1 2 3) 4) | '(1 2 3 . 4) | > (binary-append 5 "<-error") | binary-append: self-contract violation, | x = 5 | y = "<-error" | contract from: (region Dracula Program), blaming: (region | Dracula Program) | contract: (xargs :guard (true-listp x)) | at: | /Users/cce/git/planet/dracula/lang/primitive-procedures/acl2 | -prims.rkt |
|
Form for returning multiple values. This is like
list, but with the
restriction that if a function returns using
mv, then it must always
return the same number of values.
Creates a new true list containing all the given elements.
Uses
cons to add each
elem to
tail.
Reports whether
x is a list of
atoms.
Reports whether
x is a list of
characterp elements.
Same as
atom, but with the guard that
x is either a
consp or is
nil.
Reports whether
x is a list of
eqlablep elements.
Reports whether
x is a list of
integerp elements.
Reports whether
x is of even length and every other element in the list satisfies
keywordp.
Reports whether
x is either a
consp or
nil.
Returns true if
x equals
nil (using
eq).
Reports whether
x is a proper (
nil-terminated) nonempty list
Reports whether
x is a list of
rationalp elements.
Reports whether
x is a list of
stringp elements.
Reports whether
x is a list of
symbolp elements.
Reports whether
x is a list of
true-listp elements.
Reports whether
x is a proper
nil-terminated list.
(butlast l n) is the list obtained by removing the last n elements from the true list l.
Coerces
x to a true list by replacing the final
cdr with
nil.
Finds the length of the given list. Returns 0 if lst is not a list.
Makes a list of the given length, filling it in with
nil.
Gets the nth element of lst
Gets the
nth
cdr of the given list
Reverse the given list or string
Replaces the
nth (0-based) position in
lst with the value
v. If
n is greater than the length of
lst, then
update-nth will add padding to the end of the list consisting of
nil values.
first member of the list
fourth member of the list
fifth member of the list
Sixth member of the list
eighth member of the list
last member of the list