Changes between Version 2 and Version 3 of Arrays


Ignore:
Timestamp:
09/14/13 14:45:36 (13 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Arrays

    v2 v3  
    1 = Arrays =
     1== True Arrays ==
    22
    33C uses an "array-pointer" pun.  This is not a particularly useful feature and leads to a lot of confusion.  In C, code such as
     
    5757}}}
    5858
     59== Sequence Operations ==
     60
     61The following operations are available for arrays:
     62
     63* `int $length(T a[[]])`
     64 * returns the number of elements in this array
     65* `T[[]] $concat(T a[[]], Tb[[]])`
     66 * returns the concatenation of two arrays
     67* `T[[]] $add(T a[[]], T x)`
     68 * returns the result of adding the element `x` to the end of array `a`
     69* `T[[]] $remove(T a[[]], int i)`
     70 * returns the result of removing the element at index `i` from the array `a` (with subsequent element shifted down)
     71* `T[[]] $subseq(T a[[]], int start, int end)`
     72 * returns the subsequence of `a` starting at index `start` and ending at index `end-1`
     73* `T[[]] $write(T a[[]], int i, T x)`
     74 * returns the sequence obtained by replacing the element of `a` at index `i` with `x`
     75
    5976== Other related ideas ==
    6077