wiki:Sequences

Sequences

It would be convenient for CIVL-C to have a sequence type. This avoids the array/pointer conversions in C, allows sequences to be passed around by value, and allows for standard sequence operations.

  • $seq<T>
    • a sequence of elements of type T
  • int $seq_length($seq<T>)
    • returns the number of elements in this sequence
  • $seq<T> $seq_concat($seq<T>, $seq<T>)
    • returns the concatenation of two sequences
  • $seq<T> $seq_add($seq<T> a, T x)
    • returns the result of adding the element x to the sequence a
  • $seq<T> $seq_remove($seq<T> a, int i)
    • returns the result of removing the element at index i from the sequence a
  • $seq<T> $seq_subseq($seq<T> a, int start, int end)
    • returns the subsequence of a starting at index start and ending at index end
  • $seq<T> $seq_write($seq<T> a, int i, T x)
    • returns the sequence obtained by replacing the element of a at index i with x
  • T $seq_read($seq<T> a, int i)
    • returns the element of a at index i
Last modified 13 years ago Last modified on 09/10/13 13:55:40
Note: See TracWiki for help on using the wiki.