| Version 1 (modified by , 13 years ago) ( diff ) |
|---|
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
xto the sequencea
- returns the result of adding the element
$seq<T> $seq_remove($seq<T> a, int i)- returns the result of removing the element at index
ifrom the sequencea
- returns the result of removing the element at index
$seq<T> $seq_subseq($seq<T> a, int start, int end)- returns the subsequence of
astarting at indexstartand ending at indexend
- returns the subsequence of
$seq<T> $seq_write($seq<T> a, int i, T x)- returns the sequence obtained by replacing the element of
aat indexiwithx
- returns the sequence obtained by replacing the element of
T $seq_read($seq<T> a, int i)- returns the element of
aat indexi
- returns the element of
Note:
See TracWiki
for help on using the wiki.
