1.4.12 Sequences
(coerce x y) → t |
x : (if (equal y 'list) (stringp x) (if (equal y 'string) (character-listp x) nil)) |
y : t |
Coerces a character list into a string or a string into a list. The second argument must be either 'string or 'list.
Examples: | ||||
|
(concatenate sym seq ...) |
Concatenates strings or lists together. If the first argument is 'string, concatenate will accept strings to concatenate. If the first argument is 'list, it will accept lists.
Examples: | ||||||||||
|
(length x) → t |
x : (or (true-listp x) (stringp x)) |
Returns the number of elements in the given list, or the number of characters in the given string.
(position x seq) → t |
x : t |
seq : (or (stringp seq) (and (true-listp seq) (or (eqlablep x) (eqlable-listp seq)))) |
Determines the (0-based) position in seq at which x first occurs. Uses eql for comparisons. Returns nil if x is not found.
(position-eq x lst) → t |
x : t |
lst : (and (true-listp lst) (or (symbolp x) (symbol-listp lst))) |
Determines the (0-based) position in lst at which x first occurs. Uses eq for comparisons. Returns nil if x is not found.
Example: | ||
|
(position-equal x seq) → t |
x : t |
seq : (or (stringp seq) (true-listp seq)) |
Determines the (0-based) position in seq at which x first occurs. Uses equal for comparisons. Returns nil if x is not found.
Examples: | ||||||
|
(subseq seq i j) → t |
seq : (or (true-listp seq) (stringp seq)) |
i : ((integerp i) (<= 0 i)) |
j : (and (or (null j) (and (integerp j) (<= j (length seq)))) (<= i (or j (length seq)))) |
Returns a subsection of the given sequence, starting at the ith (inclusive, 0-based) position and ending at the jth (exclusive) position. If j is nil, then subseq will return the list to the end.
Examples: | ||||||
|
(substitute new old seq) → t |
new : t |
old : t |
seq : (or (and (stringp seq) (characterp new)) (and (true-listp seq) (or (eqlablep old) (eqlable-listp seq)))) |
Substitutes every occurrence of old with new in the given list or string.
Examples: | ||||
|