(pfds sequence)

sequence? : any -> bool returns #t if the argument is a sequence, #f otherwise.

(make-sequence)

make-sequence : () -> sequence returns a new empty sequence

(sequence-empty? seq)

sequence-empty? : sequence -> bool returns #t if the argument sequence contains no elements, #f otherwise.

(sequence-size seq)

sequence-size : sequence -> non-negative integer returns the number of elements in the sequence

(sequence-cons value seq)

sequence-cons : any sequence -> sequence return the new sequence created by adding the element to the front of the sequence.

(sequence-snoc seq value)

sequence-snoc : sequence any -> sequence return the new sequence created by adding the element to the end of the sequence.

(sequence-uncons seq)

sequence-uncons : sequence -> any sequence returns two values: the first element of the sequence, and a new sequence containing all but the first element. If the sequence is empty, an error is raised.

(sequence-unsnoc seq)

sequence-unsnoc : sequence -> sequence any returns two values: a new sequence containing all but the last element of the sequence, and the last element itself. If the sequence is empty, an error is raised.

(sequence-append seq1 seq2)

sequence-append : sequence sequence -> sequence returns a new sequence containing all the elements of the first sequence, followed by all the elements of the second sequence.

(list->sequence list)

list->sequence : Listof(Any) -> sequence returns a new sequence containing all the elements of the argument list, in the same order.

(sequence->list seq)

sequence->list : sequence -> Listof(Any) returns a new list containing all the elements of the sequence, in the same order.

(%sequence . args)

(sequence-split-at seq i)

sequence-split-at sequence integer -> sequence + sequence returns two new sequences, the first containing the first N elements of the sequence, the second containing the remaining elements. If N is negative, it returns the empty sequence as the first argument, and the original sequence as the second argument. Similarly, if N is greater than the length of the list, it returns the original sequence as the first argument, and the empty sequence as the second argument. Consequently, (let-values (((a b) (sequence-split-at s i))) (sequence-append a b)) is equivalent to s for all sequences s, and integers i.

(sequence-take seq i)

sequence-take sequence integer -> sequence returns a new sequence containing the first N elements of the argument sequence. If N is negative, the empty sequence is returned. If N is larger than the length of the sequence, the whole sequence is returned.

(sequence-drop seq i)

sequence-drop sequence integer -> sequence returns a new sequence containing all but the first N elements of the argument sequence. If N is negative, the whole sequence is returned. If N is larger than the length of the sequence, the empty sequence is returned.

(sequence-ref seq i)

sequence-ref : sequence non-negative-integer -> any returns the element at the specified index in the sequence. If the index is outside the range 0 <= i < (sequence-size sequence), an error is raised.

(sequence-set seq i val)

sequence-set : sequence non-negative-integer any -> sequence returns the new sequence obtained by replacing the element at the specified index in the sequence with the given value. If the index is outside the range 0 <= i < (sequence-size sequence), an error is raised.

(sequence-fold proc base seq)

sequence-fold (any -> any -> any) any sequence returns the value obtained by iterating the combiner procedure over the sequence in left-to-right order. The combiner procedure takes two arguments, the value of the position in the sequence, and an accumulator, and its return value is used as the value of the accumulator for the next call. The initial accumulator value is given by the base argument.

(sequence-fold-right proc base seq)

sequence-fold-right (any -> any -> any) any sequence Like sequence-fold, but the sequence is traversed in right-to-left order, rather than left-to-right.

(sequence-reverse seq)

sequence-reverse : sequence -> sequence returns a new sequence containing all the arguments of the argument list, in reverse order.

(sequence-map proc seq)

sequence-map : (any -> any) sequence -> sequence returns a new sequence obtained by applying the procedure to each element of the argument sequence in turn.

(sequence-filter pred? seq)

sequence-filter : (any -> bool) sequence -> sequence returns a new sequence containing all the elements of the argument sequence for which the predicate is true.sequence any ... -> sequence returns a new sequence containing all of the argument elements, in the same order.