length returns the length of the sequence sequence as an
lengthL is the same but returns an Lpp Integer
object as the length. For example
length(0) => 0 let list1 = list(L("one"), L("two"), L("three")); list(lengthL(list1)) => (3) length(list1) + 1 => 4 length(nth(2, list1)) => 5
|elt sequence n||Function|
elt returns element at index n of sequence
sequence. It is an error if integer index n is outside
the boundary of sequence. n can be either an
or Lpp Integer.
|setElt sequence n value||Function|
|setElt sequence n value gc||Function|
setElt sets the element at index n of sequence
sequence to value value and value is returned.
It is an error if integer index n is outside the boundary of
sequence. n can be either an
int or Lpp Integer.
If an optional fourth argument gc is given and is a function of
one argument it is applied to the element replaced. If argument
t then it defaults to the function
nil then nothing is applied. The optional fourth
gc is ignored if sequence is a String.
|subseq sequence start||Function|
|subseq sequence start end||Function|
subseq returns a copy of the given sequence sequence
from given start position index to the end of the sequence
where 0 is the beginning of the sequence. If the optional argument
end is given then that is used instead of the end of the
sequence. The end position is not included in the returned
sub-sequence. start and end can be either
Lpp Integer objects. If end is an Lpp object and is received
nil then that is also interpreted as the
end of the sequence. Some examples are
subseq(L("abcdefg"), 3) => "defg" subseq(L("abcdefg"), 3, Nil) => "defg" subseq(L("abcdefg"), 3, 5) => "de" subseq(list(L(1), L(2), L(3)), 0, 1) => (1 2)
copySeq returns a copy of the sequence sequence. A
fresh copy of the sequence is returned and it is guaranteed to be
equalp to sequence but not
eq to it. For example
let string1 = L("Hello"); let string2 = copySeq(string1); equal(string1, string2) => t eq(string1, string2) => nil
reverse returns a copy of the sequence sequence with all
of its elements reversed.
nreverse does the same as
reverse but a copy is not made and sequence is modified.
let list1 = list(L(1), L(2), L(3), L(4)); reverse(list1) => (4 3 2 1) list1 => (1 2 3 4) nreverse(list1) => (4 3 2 1) list1 => (4 3 2 1) let string1 = L("1234"); reverse(string1) => "4321" string1 => "1234" nreverse(string1) => "4321" string1 => "4321"