ASET1.html -- ACL2 Version 6.3

### ASET1

set the elements of a 1-dimensional array

    Major Section:  ARRAYS

    Example Form:
    (aset1 'delta1 a (+ i k) 27)

    General Form:
    (aset1 name alist index val)

where `name` is a symbol, `alist` is a 1-dimensional array named `name`, `index` is a legal index into `alist`, and `val` is an arbitrary object. See arrays for details. Roughly speaking this function ``modifies'' `alist` so that the value associated with `index` is `val`. More precisely, it returns a new array, `alist'`, of the same name and dimension as `alist` that, under `aref1`, is everywhere equal to `alist` except at `index` where the result is `val`. That is, `(aref1 name alist' i)` is `(aref1 name alist i)` for all legal indices `i` except `index`, where `(aref1 name alist' i)` is `val`.

In order to ``modify'' `alist`, `aset1` `cons`es a new pair onto the front. If the length of the resulting alist exceeds the `:``maximum-length` entry in the array header, `aset1` compresses the array as with `compress1`.

It is generally expected that the ``semantic value'' of `name` will be `alist` (see arrays). This function operates in virtually constant time whether this condition is true or not (unless the `compress1` operation is required). But the value returned by this function cannot be used efficiently by subsequent `aset1` operations unless `alist` is the semantic value of `name` when `aset1` is executed. Thus, if the condition is not true, `aset1` prints a slow array warning to the comment window. See slow-array-warning.