sequencesequencemodule
Various useful list functions. Note that algorithms in this module
execute largely in the caller's module namespace, so that local
rules can be used as function objects. Also note that most predicates
can be multi-element lists. In that case, all but the first element
are prepended to the first argument which is passed to the rule named
by the first element.
filtersequencerule filter ( predicate + : sequence * )Return the elements e of
$(sequence) for which
[ $(predicate) e ] has a non-null value.
transformsequencerule transform ( function + : sequence * )Return a new sequence consisting of
[ $(function) $(e) ] for each element
e of $(sequence).
reversesequencerule reverse ( s * )Returns the elements of s in
reverse order.insertion-sortsequencerule insertion-sort ( s * : ordered * )Insertion-sort s using the
BinaryPredicate ordered.mergesequencerule merge ( s1 * : s2 * : ordered * )Merge two ordered sequences using the BinaryPredicate
ordered.joinsequencerule join ( s * : joint ? )Join the elements of s into one
long string. If joint is supplied, it
is used as a separator.lengthsequencerule length ( s * )Find the length of any sequence.uniquesequencerule unique ( list * : stable ? )Removes duplicates from list.
If stable is passed, then the order
of the elements will be unchanged.max-elementsequencerule max-element ( elements + : ordered ? )Returns the maximum number in elements.
Uses ordered for comparisons or
numbers.less
if none is provided.select-highest-rankedsequencerule select-highest-ranked ( elements * : ranks * )Returns all of elements for which
the corresponding element in the parallel list
rank is equal to the maximum value in
rank.