1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
<html>
<head><title>ASET1.html -- ACL2 Version 3.1</title></head>
<body text=#000000 bgcolor="#FFFFFF">
<h3>ASET1</h3>set the elements of a 1-dimensional array
<pre>Major Section: <a href="ARRAYS.html">ARRAYS</a>
</pre><p>
<pre>
Example Form:
(aset1 'delta1 a (+ i k) 27)
<p>
General Form:
(aset1 name alist index val)
</pre>
where <code>name</code> is a symbol, <code>alist</code> is a 1-dimensional array named <code>name</code>,
<code>index</code> is a legal index into <code>alist</code>, and <code>val</code> is an arbitrary object.
See <a href="ARRAYS.html">arrays</a> for details. Roughly speaking this function
``modifies'' <code>alist</code> so that the value associated with <code>index</code> is <code>val</code>.
More precisely, it returns a new array, <code>alist'</code>, of the same name and
dimension as <code>alist</code> that, under <code><a href="AREF1.html">aref1</a></code>, is everywhere equal to <code>alist</code>
except at <code>index</code> where the result is <code>val</code>. That is,
<code>(aref1 name alist' i)</code> is <code>(aref1 name alist i)</code> for all legal
indices <code>i</code> except <code>index</code>, where <code>(aref1 name alist' i)</code> is <code>val</code>.<p>
In order to ``modify'' <code>alist</code>, <code>aset1</code> <code><a href="CONS.html">cons</a></code>es a new pair onto the
front. If the length of the resulting alist exceeds the
<code>:</code><code><a href="MAXIMUM-LENGTH.html">maximum-length</a></code> entry in the array <a href="HEADER.html">header</a>, <code>aset1</code> compresses the
array as with <code><a href="COMPRESS1.html">compress1</a></code>.<p>
It is generally expected that the ``semantic value'' of <code>name</code> will be
<code>alist</code> (see <a href="ARRAYS.html">arrays</a>). This function operates in virtually
constant time whether this condition is true or not (unless the
<code><a href="COMPRESS1.html">compress1</a></code> operation is required). But the value returned by this
function cannot be used efficiently by subsequent <code>aset1</code> operations
unless <code>alist</code> is the semantic value of <code>name</code> when <code>aset1</code> is executed.
Thus, if the condition is not true, <code>aset1</code> prints a <strong>slow array</strong>
warning to the comment window. See <a href="SLOW-ARRAY-WARNING.html">slow-array-warning</a>.
<br><br><br><a href="acl2-doc.html"><img src="llogo.gif"></a> <a href="acl2-doc-index.html"><img src="index.gif"></a>
</body>
</html>
|