next up previous contents index
Next: Nesting Sequences Up: Sequence Functions Previous: Sequence Reordering Functions

Simple Sequence Manipulation

pack(v) {[(a, bool)] tex2html_wrap_inline10228 [a] :: (a in any)}
  Given a sequence of (value,flag) pairs, pack packs all the values with a t in their corresponding flag into consecutive elements, deleting elements with an f.

v1 ++ v2 {([a], [a]) tex2html_wrap_inline10230 [a] :: (a in any)}
  Given two sequences, ++ appends them. For example:

4pt

tabular7834

subseq(v, start, end) {([a], int, int) tex2html_wrap_inline10252 [a] :: (a in any)}
  Given a sequence, subseq returns the subsequence starting at position start and ending one before position end. For example:

4pt

tabular7848

drop(v, n) {([a], int) tex2html_wrap_inline10278 [a] :: (a in any)}
  Given a sequence, drop drops the first n items from the sequence. For example:

4pt

tabular7864

take(v, n) {([a], int) tex2html_wrap_inline10306 [a] :: (a in any)}
  Given a sequence, take takes the first n items from the sequence. For example:

4pt

tabular7878

odd_elts(v) {[a] tex2html_wrap_inline10330 [a] :: (a in any)}
  Returns the odd indexed elements of a sequence.

even_elts(v) {[a] tex2html_wrap_inline10332 [a] :: (a in any)}
  Returns the even indexed elements of a sequence.

interleave(a, b) {([a], [a]) tex2html_wrap_inline10334 [a] :: (a in any)}
  Interleaves the elements of two sequences. The sequences must be of the same length. For example:

4pt

tabular7898

length_from_flags(flags) {[bool] tex2html_wrap_inline10368 [int]}
  Given a sequence of boolean flags, this will return the length from each true flag to the next. A true flag is always assumed in the first position.



Jonathan Hardwick
Tue Nov 28 13:57:00 EST 1995