next up previous contents index
Next: Scans and Reduces Up: Sequence Functions Previous: Sequence Functions

Simple Sequence Functions

#v {[a] tex2html_wrap_inline10061 int :: (a in any)}
  Returns the length of a sequence.

dist(a, l) {(a, int) tex2html_wrap_inline10063 [a] :: (a in any)}
  Generates a sequence of length l with the value a in each element. For example:

4pt

tabular7655

elt(a, i) {([a], int) tex2html_wrap_inline10077 a :: (a in any)}
  Extracts the element specified by index i from the sequence a. Indices are zero-based.

rep(d, v, i) {([a], a, int) tex2html_wrap_inline10079 [a] :: (a in any)}
  Replaces the ith value in the sequence d with the value v. For example:

4pt

tabular7672

zip(a, b) {([b], [a]) tex2html_wrap_inline10103 [(b, a)] :: (a in any; b in any)}
  Zips two sequences of equal length together into a single sequence of pairs.

unzip(a) {[(b, a)] tex2html_wrap_inline10105 ([b], [a]) :: (a in any; b in any)}
  Unzips a sequence of pairs into a pair of sequences.



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