|
|
|
|
Quelle chap21.html
Sprache: HTML
|
|
| products/Sources/formale Sprachen/GAP/doc/ref/chap21.html |
 |
<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
< html xmlns= "http://www.w3.org/1999/xhtml" xml:lang= "en">
< head>
< title>GAP (ref) - Chapter 21: Lists</ title>
< meta http-equiv= "content-type" content= "text/html; charset=UTF-8" />
< meta name= "generator" content= "GAPDoc2HTML" />
< link rel= "stylesheet" type= "text/css" href= "manual.css" />
< script src= "manual.js" type= "text/javascript"></ script>
< script type= "text/javascript">overwriteStyle();</ script>
</ head>
< body class= "chap21" onload= "jscontent()">
< div class= "chlinktop">< span class= "chlink1">Goto Chapter: </ span>< a href= "chap0.html">Top</ a> < a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chap5.html">5</a> <a href="chap6.html">6</a> <a href="chap7.html">7</a> <a href="chap8.html">8</a> <a href="chap9.html">9</a> <a href="chap10.html">10</a> <a href="chap11.html">11</a> <a href="chap12.html">12</a> <a href="chap13.html">13</a> <a href="chap14.html">14</a> <a href="chap15.html">15</a> <a href="chap16.html">16</a> <a href="chap17.html">17</a> <a href="chap18.html">18</a> <a href="chap19.html">19</a> <a href="chap20.html">20</a> <a href="chap21.html">21</a> <a href="chap22.html">22</a> <a href="chap23.html">23</a> <a href="chap24.html">24</a> <a href="chap25.html">25</a> <a href="chap26.html">26</a> <a href="chap27.html">27</a> <a href="chap28.html">28</a> <a href="chap29.html">29</a> <a href="chap30.html">30</a> <a href="chap31.html">31</a> <a href="chap32.html">32</a> <a href="chap33.html">33</a> <a href="chap34.html">34</a> <a href="chap35.html">35</a> <a href="chap36.html">36</a> <a href="chap37.html">37</a> <a href="chap38.html">38</a> <a href="chap39.html">39</a> <a href="chap40.html">40</a> <a href="chap41.html">41</a> <a href="chap42.html">42</a> <a href="chap43.html">43</a> <a href="chap44.html">44</a> <a href="chap45.html">45</a> <a href="chap46.html">46</a> <a href="chap47.html">47</a> <a href="chap48.html">48</a> <a href="chap49.html">49</a> <a href="chap50.html">50</a> <a href="chap51.html">51</a> <a href="chap52.html">52</a> <a href="chap53.html">53</a> <a href="chap54.html">54</a> <a href="chap55.html">55</a> <a href="chap56.html">56</a> <a href="chap57.html">57</a> <a href="chap58.html">58</a> <a href="chap59.html">59</a> <a href="chap60.html">60</a> <a href="chap61.html">61</a> <a href="chap62.html">62</a> <a href="chap63.html">63</a> <a href="chap64.html">64</a> <a href="chap65.html">65</a> <a href="chap66.html">66</a> <a href="chap67.html">67</a> <a href="chap68.html">68</a> <a href="chap69.html">69</a> <a href="chap70.html">70</a> <a href="chap71.html">71</a> <a href="chap72.html">72</a> <a href="chap73.html">73</a> <a href="chap74.html">74</a> <a href="chap75.html">75</a> <a href="chap76.html">76</a> <a href="chap77.html">77</a> <a href="chap78.html">78</a> <a href="chap79.html">79</a> <a href="chap80.html">80</a> <a href="chap81.html">81</a> <a href="chap82.html">82</a> <a href="chap83.html">83</a> <a href="chap84.html">84</a> <a href="chap85.html">85</a> <a href="chap86.html">86</a> <a href="chap87.
<div if level=0then
<p id list[os;
<p><a id="X7B256AE5780F140A" name="X7B256AE5780F140A"></a></java.lang.StringIndexOutOfBoundsException: Range [1, 61) out of bounds for length 5
<div =ChapSects> href"chap21.html#X7B256AE5780F140A">21 <span class="Heading">Lists</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X86B28F5B781FFD31">21.1 <span class="Heading">List Categories</span></a>
</span>
div ="ContSSBlock>
<span class="ContSS"><br /><span class="nocss"> </span><a java.lang.StringIndexOutOfBoundsException: Range [69, 0) out of bounds for length 0
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X870AA9D8798C93DD">21.1-2 IsDenseList</a></span>
s "ontSS"</>spanclass=""  />ahref=chap21
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X80872FAF80EB5DF9">21.1-4 IsTable</a></span>
<span class="ContSS"><br /><span class="nocss"> </span<>aid=X8611EF768210625B"name=X8611EF768210625Ba<pjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
<spanclass="ContSS">br />< ""&&bsp;/< hrefchap21html
</div></div>
<div class="ContSect"><span class="tocline">
</span>
<divpcodeclass=>A"<[var ""ix</> =v"java.lang.StringIndexOutOfBoundsException: Range [98, 97) out of bounds for length 123
<span class=<Theelementassignmentassigns < "></var,which be of type listwithindex<varclass""ix/var>, the mutable ( a=chap12html#X7F0C119682196D65"><span class="RefLink">12.6</span></a>) list <var class="Arg">list</var>. That means that accessing the <var class="Arg">ix</var>-th element of the list <var class="Arg">list</var> will return <var class="Arg">object</var> after this assignment.</p>
</div></div>
div class"ContSect"spanclass=tocline< =nocss>nbsp;<span<a href=chap21#X7921047F83F5FA28">21.3 <span class="Heading">List Elements</span></a>
</span>
<div class="ContSSBlock">
<span class< =GAPprompt"gapgt;<span <spanclass="APinput">1 =3; # assign a new object</span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.[3, 2,3 ]
</span>
<iv class=""
<span class="ContSS"><br /><span class="nocss"> </span><a href="[ 3 [ 5 6 ] 3
<span class="ContSS"><br /><span class="nocss">< class=GAPprompt>&;/span <class=G"l[ l[1] ] =10; l;#lt;index& /span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7E98B11B79BA9167">21.4-3 Remove</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X79D7E96F80A2D7C0">21.4-4 CopyListEntries</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X79E31DB27C82D6E1">21.4-5 Append</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<span>
<div class="ContSSBlock">
<span class="ContSS">java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<span class="ContSS"><br /><span class="nocss"d class=e"<>
</div></div>
<div class="ContSect"><span class="tocline"><<span class="GAPprompt">gap></span> <span classl[ = "anotherentry";; ;# <list> is enlarged</span>
<
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"span="APprompt"gap&;/pan> spanclass="APinput"l[ =; l;#now ltlist&;/java.lang.StringIndexOutOfBoundsException: Index 128 out of bounds for length 128
</span>
</div>
<div class="ContSect"><span /pre<div>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7B914A287F88ED0A"><code>21.8-1 \in</code></a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X84D6FC7E7E39ED33">21.9 <span class="Heading">Enlarging Internally Represented Lists</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X78BF67A5802E93AD">21.9-1 EmptyPlist</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X8016D50F85147A77">21.10 <span class="Heading">Comparisons of Lists</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </spanjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
</>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X84D642967B8546B7">21.12 <span class="Heading">Filters Controlling the Arithmetic Behaviour of Lists</span></a>
</pan>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X87ABCEE9809585A0">21.12-1 IsGeneralizedRowVector</a></span>
<span class="ContSS"<br /<pan "">nbsp;nbsp;/span<ahref="chap21.html#X7FBCA5B58308C158">21.12-2 IsMultiplicativeGeneralizedRowVector</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7BAD12E67BFC90DE">21.12-3 IsListDefault</a></span>
<span class="java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
class=">br/>span class=>;nbsp<< =chap21#X84B383B97FD986CD">21.12-5 NestingDepthM</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span < =Ggap&</span>< "l = 2,3, ,7, 11,, ,19 ;<spanjava.lang.StringIndexOutOfBoundsException: Index 106 out of bounds for length 106
</span>
<div class="GAPprompt>ap>/span <spanclass"">l{[.4} : [.13;; l/pan>
<span class="ContSS"><br ,11 ,1311, 1317, ]
</span>
<span <span classGAPprompt>><span java.lang.StringIndexOutOfBoundsException: Range [60, 50) out of bounds for length 105
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 36
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7C3DC8BE78DEECDE">21.13-4 <span class="Heading">Subtraction of lists</span></a>
</span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X782ED7F27D8C7FC1">21.14 <span class="Heading">Multiplicative Arithmetic for Lists</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span classjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
</span>
<span< class=">pre>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X84FDB95179BFE4CD">21.14-3 <span class="Heading">Multiplication of lists</span></a>
</span>
<spanclass=ContSS"<br /< class"nocss"&;nbsp</>a href"chap21.java.lang.StringIndexOutOfBoundsException: Index 164 out of bounds for length 164
/>
<span class="ContSS"><br /><span class="nocss">/</iv
<java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
>class"nocss&;nbsp;/span<.html#X84BB2DFB8432A1A4">21.14-6 <span class="Heading">Left quotients of lists</span></a>
</span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X8676EFE67972FD06">21.15 <span class="Heading">Mutability Status and List Arithmetic</span></a>
</span>
<divclass"ContSSBlock">
<span class="ContSS"><br /><spanContSS>< /<span class=nocss>nbsp;nbsp;<span<a href"chap21.html#X82B1411E7FBE925F">21.21-3 SumX</a></span>
<div</div>
<div class="ContSect"><span class="tocline"<div>/div>
</span>
<div class="ContSSBlock">
<spanclass="ContSS">""> =nocss">&bsp</>a =tml#X79596BDE7CAF8491">21.22 <span class="Heading">Ranges</span></a>
<span class="ContSS"></spanjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
<span class=ContSS"< >< class="< /span "">nbsp /span< href=chap21.#X86DDC2FF7A50FBEE">21.22-1 IsRange</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7D2B25B484591506">21.16-4 PositionNthOccurrence</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a< class=ContSSjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
<<>Theexact is defined in the same way as<>div>
< =ContSect"spanclass=tocline>< class=nocss>nbsp;/span>ahref"html#X7EA3ACE27E43D174">21.23 <span class="Heading">Enumerators</span></a>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.<span>
<span class="ContSS"><br /><span class="nocss< =ContSS"< >span=nocss"><iv"<>
<span <div><java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
n =ContSS>br/< class=n>nbsp&;/>< href".tml
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html</span>
<span class="ContSS"><br /><span <span class="ContSS"><br /><span classnbsp;nbsp<span> ".#X8438CB908367254C">21.24-1 PlainListCopy</a></span>
">br /<spanclass=nocss"&&<span< =chap21html
<span class="ContSS"//>
</div></div>
="span=tocline>classn"&;<java.lang.StringIndexOutOfBoundsException: Range [77, 76) out of bounds for length 191
</span>
<div class="ContSSBlock">
spanclass=ContSS>br code ""varArg"java.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 540
java.lang.StringIndexOutOfBoundsException: Range [129, 5) out of bounds for length 140
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7BAA9B0E81D4A884">21.17-3 IsSortedList</a></span>
<span class="ContSS"><br /><java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<span class<iv=example">pre
<span class="ContSS"><br /><span class="nocss"> </span><a href="java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 53
<div class="ContSect"><span java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 9
<span>
<div class="ContSSBlock">
<spanif =0 java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
class="nocss">nbsp list[s:vals
<span class="ContSS"><br /><spanjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
span ""><br/ "" />a".html
</div></div>
<div classjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
anjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
<div class="ContSSBlock">
<od
< class=ContSS><br/<class">n;nbsp;/>java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
<span class="ContSS"><br /><java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
s=>br/< class"ocss>n&;<span>a="</re<div
<span class="ContSS"><br /><span class="nocss"> java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<span class="ContSS"ment< =code>varclass"Arg">/{varclass"o level <var class="Arg></var>iscomputedas<code class="code>ListAssignments(varclass"rg"list<var,< class""poss/var>, var class""</>,< =Arg>/var>)/code>, where <code class="code">ListAssignments</code> isdefined java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 11
<span class="ContSS"><br /><span class=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<span class="ContSS"><<div class="example"><pre
</java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 12
<div class="ContSect<>Each listconstructedthis way is mutable (see <a java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 9
/>
<div class="ContSSBlockp< id"" =<poss =;
<java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
<span class="ContSS"><br /><span class=" ijava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
spanclass=ContSS>br/<span ">&;nbsp;/java.lang.StringIndexOutOfBoundsException: Range [0, 65) out of bounds for length 54
<span class="ContSS"><br /><span class ;
span=""<br/< class""nbsp;nbsp<span< href"hap21html#X7F5D4DD87E4378AC">21.20-5 AsDuplicateFreeList</a></span>
<span class="ContSS"><br /><spanjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0
<span <prediv
spanclass=ContSS"<br >span ="ocss"&;nbsp;/>ajava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
span t
<span class="ContSSfalse
<span class="ContSS"><br<pre>/java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
<span class="ContSS<>a="c>code2141{\=><>
</span>
<span class="ContSS"><br
</span>
<pan ""<< ="table=func"=100"tr< =tdleft"<ode func"‣ \{\}\:\=</code>( <var class="Arg">list</var>, <var class="Arg">poss</var>, <var class="Arg">val</var> )</td><td class="tdright">( operation )</td></tr></table></div>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a table=func width=100"><><dclass""codeclass"unc>&8227;IsDenseList<code(<arclass=">bj/var>)/td><d class=
</span>
span class=ContSS>br /><span class=nocss>&bsp&;/span><a hrefjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href
<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
span class="ContSS">br/>spanclass=nocss">nbsp&bsp;/span>a href=chap21.html#X7C86D7F7795125F0">21.20-19 Filtered</a></span>
<span class"ontSS>br/<spanclass<class>gt</pan<an =">IsDenseList([1 2,3 ] )</pan
<span class="ContSS"><br /><span class=spanclass=GAPprompt>&;<span><pan class""l: 4 > =>/> class="glistvar twoargumentversion var =Arg"<var theend varclass"Arg"<var>,i.e,isjava.lang.StringIndexOutOfBoundsException: Index 214 out of bounds for length 0
<span class="ContSS"><br /><span class="nocss">&bsp;nbsp;</span><a href="chap21.html#X7E5B62E780421CE9">21.20-22 Last</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7F06961278166671">21.20-23 ForAll</a></span><p>is <class=funcAdd<code> thefunction side<p>
spanclass
<span class="ContSS"><br /><span class<>List: lt;gt[ have assigned
<spanclass=ContSS"< >s class=n>nbsp;nbsp;/>java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
<span class="ContSS"><br java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<span class="ContSS"><<div class"func>table class=func"width=100"<tr><td class"">< class"unc>&n style='color:green'>#8227; Remove</code>( <var class="Arg">list</var>[, <var class="Arg">pos</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X805CA0B68029B47A">21.21 <span class="Heading">Advanced List Manipulations</span></a>
</span>
<div class="ContSSBlock">
<panclassjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
< class"ContSS"< ><span = java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 124
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X82B1411E7FBE925F">21.21-3 SumX</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7FB318B47D8783DA">21.21-4 ProductX</a></span>
</div>/ivjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
<div class="ContSect"><span java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 0
/spanjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
<div class="ContSSBlock">
<> requestingthe < classcode>]/code> was assigned,caused entryofa<ode class=keyw"break>loop see Section<ahref=chap6.tml#X8593B49F8705B486"><span class="RefLink">6.4</span></a>). After assigning a value and typing <code class="code">return;</code>, <strong class="pkg">GAP</strong> is finally able to comply with our request (by responding with <code class="code">16</code>).</p>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X83896BC481536B07">21.22-2 IsRangeRep</a></span>
span class"">< /<pan class=nocss>nbsp&;<span< href"chap21.html#X7D22B2298167A58F">21.22-3 ConvertToRangeRep</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><<span class="GAPprompt">gap></span> <span class">(l4,2;ljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
</span>
<div class="ContSSBlock">
pan""ContSS"br/>spanclass=nocss>nbsp;nbsp;/>=".html#X7BB462C17962647F">21.23-1 IsQuickPositionList</a></span>
</div></div>
<<>eturns< class< "GAPprompt"gap;span span ""Removel2;l;/
</span>
<div class="ContSSBlock">
=ContSS"< />span =n"&;&;/>ahref".
<span [ 2,, 57java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
</div></div>
</<div=example<re>
<h3>21 <span class="Heading">Lists</span></h3>
importanttotreatobjectstogether <><>arranges a impliesamapping integers elements .I.,here afirstelement list, second third,and .Lists occurin mutableor , < ="chap12.#X7F0C119682196D65"><span class="RefLink">12.6</span></a> for the concept of mutability, and <a href="chap21.html#X7ED7C0738495556F"><span class="RefLink">21.7</span></a> for the case of lists.</p>, ]
<p>This chapter deals mainly with java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 0
ranges( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>Severaloperationsfor lists, such as < ="func"<
<p><adiv <>A<em</em>isanonempty of lists thesame Typical tables arematrices s<hrefchap24.#X812CCAB278643A59"><span class="RefLink">24</span></a>).</p>
<h4>21spanclass">&;/pan><pan class=" <fAddcode(ajava.lang.StringIndexOutOfBoundsException: Index 318 out of bounds for length 318
writingdown injava.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 308
< ""java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<span classjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
[ 1, 2, 3 ]
<span class="GAPprompt">gap&java.lang.StringIndexOutOfBoundsException: Range [28, 0) out of bounds for length 0
[ [],[ 1] [1 2 ]<java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 248
</pre>/div>
<p>Each list constructed this way is mutable (see <a href="chap12.html#X7F0C119682196D65"><span class="RefLink">12.6</span></a>).</p>
<p<a =X7C4CC4EA8299701E"name"X7C4CC4EA8299701E"<>2115/>
<h5>21.1-1java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="func"><table<pNote<Alistlies <java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 169
<>tests whether <var class="obj<var is a list./>
<div class="example"><pre>
<span class="GAPprompt">gap><
true
false
</pre></div>
<p><a <div =example"<reC"name""//
<h5>21.1-2 IsDenseList</h5>
<div class="func"><
<p[ <class=>class="width="%tr< java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 234
<div class="example"><pre>
<class=GAPprompt">gap&;s>s class="APprompt">ap&<span span class=""Append l, 17,23]; ;/pan>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">l := [ , 4, 9,, 25,, 49,,,, 121 ];; IsDenseList( l );</span>
false
<span class="GAPprompt">gap></span> <span class="GAPinput"java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
9
spanclass"p>The basic operationssee<href".
List Element: <list>[4] must have an assigned value
not function
Entering break read-eval-print loop ...
you can 'quit;' to quit to outer loop, or
you can 'return;' after assigning a value to continue
<span class="GAPbrkprompt">brk></span> <span class="GAPinput">l[4] := 16;; # assigning a value</span>
<span class="GAPbrkprompt">brk></span> <span class
16
gt;
</pre></div>
<p><p>The ter basic =java.lang.StringIndexOutOfBoundsException: Range [55, 52) out of bounds for length 62
<p><5>21.51java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
<h5>21.1-3 IsHomogeneousList</h5>
<div class="func"><table class="func"<>a < "><table ="func =100"<>tdclass""< class""‣ IsBound</code>( <var class="Arg">list</var>[, <var class="Arg">n</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns <code class=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p><divclass""<table ="" =100"<=example<pre>
<div class="example"><pre>
< class="GAPprompt>>/span> <span class=GAPinput">(1 2,3]) IsHomogeneousList ];<>
true
true
span="GAPprompt>gap>/span> <spanclass="GAPinput">IsHomogeneousList [ 1, false, ) ] );/>
false
</pre></div>
<>aidX80872FAF80EB5DF9=<>>
h5211- </h5java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
<div class="func"><table class="func" width="100%"><tr>java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>A <em>table</em> is a nonempty list of homogeneous lists which lie java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="example"><pre>
<span classp java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 0
true
<span classjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [4, 5) out of bounds for length 4
span""gap>class=" =< class=""#;ode<classArgvar< =Arg>/var, v ="><var> </td<td=tdright"(operationnbsp;<td>/tr><table></>
false
</pre></div>
<p><a id="
<h5>21.1-5 IsRectangularTable</h5>
<div class="func"><table class="func" width<pIfvar =Arg>/varisnotabuiltjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
p>p>odeclass""> classArg"listv{varclass=rgposs</>}/code>/pjava.lang.StringIndexOutOfBoundsException: Index 91 out of bounds for length 91
<p< class""prejava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
<h5>21.1-6 IsConstantTimeAccessList<class">&;/>span class="java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 94
<div class="func"><table class="func" width="100%"><tr[2 17,2
<>Thiscategory whetheraccess element thelist<class"Arg">/var 1 2,a"]
(eeahref="chap21java.lang.StringIndexOutOfBoundsException: Range [50, 0) out of bounds for length 0
<p><a id="X7B202D147A5C2884" name="X7B202D147A5C2884"></<> result < class"APprompt>&t/>< ">(l2,ewobj)/spanjava.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98
<h4>21.2 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
p>hebasicoperationsforlistsareelement( a ="chap21htmlX7921047F83F5FA28
<p>s class"GAPprompt"s =GAPprompt>&;/><spanclass=GAPinput"m =[ 2,3] 456,[7,,]
<p>Any ""
<p><panclass""gapgt<span <span/>
<>aidjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
<h5<>212-1 <>/>java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
< class=func>table ="=100"<>t ""<code =func#8227; <span>\</span>[<span>\</span>]</code>( <var class="Arg">list</var>, <var class="Arg">ix</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
iv"" ""width"">tdclass""java.lang.StringIndexOutOfBoundsException: Range [80, 79) out of bounds for length 300
divclass%<><td">code =>#;Unbind><span>/>]/>java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<521.5-Unbind<h5>
<p>Note java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
<p><code class=< class""<table
<pp< =func/ with< =""varthe java.lang.StringIndexOutOfBoundsException: Range [112, 111) out of bounds for length 639
<p>Analogous statements hold for <code class="func"><span>\</span>[<span>\</span>]\:\=</code> and <code class="func">Unbind<span>\</span>[<span>\</span>]</code>. java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
<p><a id="X7921047F83F5FA28" name="java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 4
<h4<> codeclass"code"<varclass"Arg"list<var{<var =Arg></java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p><code class="code"><var class="Arg">list</var>[ <var class="Arg">ix</var> ]</code></p>
<p>The above construct evaluates to ListElements := function ( list, poss,
<<re>
<span class="[, 2,, 5,, ,,,, 11 ]
2
3
13
<pre</>
<> < class"Arg 2,,,,,,11 java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
<p><code class="code"><var class="Arg">list</var/>/div>
<p>Thep<p> codeclass"IsBoundcode( =java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 537
<div class="example"><pre>
<span class="GAPprompt">gap></spanjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<span class="GAPprompt">gap></span> <span class="GAPinput">l{[4..6]}; l{[1,7,1,8]};</span>
[ 7, 11, 13 ]
[ 2, 17, 2, 19 ]
</pre></<421. span class=Heading"IdenticalLists</pan</java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
, that not java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>tis possible to such <>sublist extractions
<divjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
">><span <span "GAPinput">m: [[,2,3], [,, [,,] 10,,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[ [ 3, 2 ], [ 6, 5 ], [ 9, 8 ] ]
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[[ 7, 8 9 ],[ ;
</pre></div>
<p>Note the difference between the two examples. <> list assignmentassigns the < =""object/>, canbeof any type, to the list with index <var class="Arg">ix</var>, in the mutable (see <a hrefjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>To be precise: With each selector <code class="code">[<var class="Arg">pos</var>]<<panclass=GAPpromptgap<span><span java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="example"><pre>
l[pos1]{poss2}{poss3}[pos4]{poss5}[pos6]
level 0 0 1 2 2 3
</pre></div>
pThen odeclass=ode> class""><[ar =A"posvar]code oflevel<class=Arg><> <">(< ""list/>< "Arg"pos/,var =Arg>/)p/
mple"<> assignment doesnot change the first list itassignsa new list thevariable <code class="code">l</code>. On the other hand, in the following example the list <em>is</em> changed by the second assignment.</p>
<pjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if level= 0 then
return list[pos];<iv ""<pre
else
->ListElement(elm,pos,level-1) );
fi;
end;
</pre></div>
<p>and a selector <code class="code"><var class="Arg"span ="GAPprompt>java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div</re><divjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
ListElements := java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
level=0 then
return list{java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
else<pNote that assigning re
return java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
<pIf<=Arg><var notevaluatejava.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 565
end;
</pre></div>
<p><a java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<h5><code>21.3-1 \{\}</code></h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&an style='color:green'>#8227; \{\}</code>( <var class="Arg">list</var>, <var class="Arg">poss</var> )</td><td class="tdright">( operation )</td></tr></table></div>2 ];
<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p><a id="X8611EF768210625B" name="X8611EF768210625B"></a></p>
<>.4 < =Heading"ListAssignment<span><h4
p< "code"<class="">/varvar> varclass""><var ]=< =Arg></><code</>
<p>The listspanjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span""gap&t =[,2];
< class=GAPprompt>gap&;/span><span class="GAPinput">l[1]]: 3l2: l1;
[ 3, 2, 3 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">l[2] := [ 4, 5, 6 ];; l;
java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 21
<span class="
[ 3, [ 4, 5, 6 ], 10 ]
<pre>/ivjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>Let us now consider under which circumstances lists identical/<classjava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 124
<span class="GAPprompt">gap></span> <span class="GAPinput">l[4] := "another entry
[3, 4, 5 6] 10 another entry" ]
<span class="java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
try,> enterlist then byisnewlist isnot toany other in example <ode class=code></code> and< class=
</pre></div>
<p>The function <code class="func">Add</code> (<a href="chap21java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
thatto a list changes the list thus this listmust bemutable (ee <ahref".tml#X7F0C119682196D65"><span class="RefLink">12.6</span></a>). See <a href="chap21.html#X7DD65BEA7EDB0CD7"><span class="RefLink">21.6</span></a> for subtleties of changing lists.</p>
pIf< class=Arg"list/var>does notevaluateto a list varclass=Arg>pos/> does not evaluate a integer, methodselection is invoked to try and find a way of indexing <var class="Arglevel 0 1 1 2
<p
>sublistthe< =code">var<lso inexample, list code =></ode identical../>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">l := [ 2, 3, 5, 7, 11, 13, 17, 19 ];;</span>
<span class="GAPprompt">gap i;
[ 10, 11, 12, 13, 11, 13,<div class="example" then
<span class="GAPprompt">gap></span> <span class="GAPinput">l{[else
[3,11, 12 for 1.] do
</pre>t [] java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 52
<>The next showsthatit is possible to;
<div"">
<span class="GAPprompt">gap></span> <span class="GAPinput">m java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<span class="GAPprompt">gap></span> <span class="GAPinput">m{[1,2,3]}{[3,2]} := [ [11,12], [13,14], [15,16] ];; m;</span>
[ [ 1, 12, 11 ], [ 4, 14, 13 ], [ 7, 16, 15 ],< =>pre
</pre></div>
<p>The exact behaviour is defined in the same way as for list extractions (see <a href="chap21.html#X7921047F83F5FA28"><span class="RefLink">21.3</span></a>). Namely, with each selector <code class="code">[<var class="Arg">pos</var>]</code> or <code class="code">{<var class="Arg">poss</var>}</code> we associate a <em>level</em> that is defined as the number of selectors of the form <code class="code">{<var class="Arg">poss</var>}</code> to its left in the same expression. For example</p>
<div class="example"><pre>
l[pos14
level 0 0 1 1 1 2
<
<p>Then [,3,5 java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
<div class="example"><pre>
ListAssignment := function ( list,
locali;
if level = 0 then
list[pos] := java.lang.StringIndexOutOfBoundsException: Range [0, 19) out of bounds for length 0
else
for i in [1..Length(list)] do
,pos ,-1 )
od;
fi;
end;
</pre></div>
<><codeclass""CopyListEntries/> used in < class""Add/> (<a href"hap21java.lang.StringIndexOutOfBoundsException: Range [318, 152) out of bounds for length 318
dclasse>prejava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
ListAssignments := function ( list, <h5>.45 Append/h5>
local i;
if level 0
list{poss} := vals;
else
for i in [1..Length(list)] do
] poss, vals[i,- )java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
od;
fi;
end;
</pre></div>
<p><a id="X813FF1637F8D2B7F" name="X813FF1637F8D2B7F"<class"
<h5><code>21.4-1 \{\[2,,5,, 17,23]
<div class="func"><table class=<< ""=>a>>
<p>This operation implements sublist assignment. java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p><a id="X795EC9D67E34DAB0" name="X795EC9D67E34DAB0"></a></p>
<h5>21.4-2java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="func"><<div class="func"><table= =100%>tr tdleft> ">
<p>adds the element <var class="Arg">obj</var> to the mutable list <var <><odeclass=func<code> class">< list< ="/>has indexvar=>, k"<code .var "/> toan for afor<class"\\<> installed otherwisean ./>
<><re>
<p>Nothing is returned by <code class="func">Add<<pan""&;/>s "java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 106
p>"/><p>
<rue
div""< =func=100"<> class""< ">#8227; Remove</code>( <var class="Arg">list</var>[, <var class="Arg">pos</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>removes java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
<p>java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
<p>The two argument form returns the <><a id=X866F45D3797FDA00name=X866F45D3797FDA00>/>/>
<div class="example"><pre>
<span classdiv="< ""width"%>>tdclass"">code""&8227 code(<java.lang.StringIndexOutOfBoundsException: Range [135, 134) out of bounds for length 283
,3 , java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
<span class="GAPprompt">gap></span> <span class="GAPinput">Add(l,4,2); l;</span>
[ 2, 4, 3, 5, 7 ]
span =G>&;/><classGAPinputRl2;;<
4
[ 2, 3, 5java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<<p>Todistinguishvar Argnvarth element varclass"">in<ar =Arglist create new ,suchstring< ><code (href=.htmlX7961183378DFB902< class"12.51</>a)returns code class=keyw>/>for differentmutable strings, even if their contents are the same.</p>
7
[ 2, 3, 5 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">Remove(l,5); l;</span>
[ 2, 3, 5 ]
</pre
<piv =""<pre>
<h5>21.4-4 span class="GAPprompt< spanjava.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 85
=func"<table =func ="<r>td class=tdleft"< java.lang.StringIndexOutOfBoundsException: Range [87, 85) out of bounds for length 410
<p>This function copies <var class="Arg">n</var> elements from <var class="Arg">fromlst</var>, starting at position <var class="Arg">fromind</var> and incrementing the positionjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
<p><code class="func">CopyListEntries</code> is used < class=""gap&t/>< =GAPinput>java.lang.StringIndexOutOfBoundsException: Range [78, 76) out of bounds for length 98
<< =X79E31DB27C82D6E1 ""<a<p>
<h5>21.4-5 Append</h5>
<div class="func"<5215</5>
ar>to end mutable list< =""list1>, see< href="chap21html#X8611EF768210625B"><span class="RefLink">21.4</span></a>. <var class="Arg">list2</var> may contain holes, in which case the corresponding entries in <var class="Arg">list1</var> will be left unbound. <code class="func">Append</code> returns nothing, it is only called for its side effect.</p>
<p>Note that <code class="func">Append</code> changes its first argument, while <code class="func">Concatenation</code> (<a href=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
d "">>
<span class=" , 2,, 5,, 7,,,, 11]
[ <span class="GAPprompt">gap></span> <span class="GAPinput">Unbind(
span class="GAPprompt">gap></span> <span class="GAPinput">Append( l, [ 17,, 23 ] ); l;</span>
[ 2, 3, 5, 7, 11, 13, 17,, 23 ]
<>/
<p><a id="X7963C8E17EFF86DB" name="X7963C8E17EFF86DB"></a></p>
<h4>/>/div valueof< "ode"1/ode,whichcode>/ to codeclass""i</. same thing happens inthe example/java.lang.StringIndexOutOfBoundsException: Index 376 out of bounds for length 376
<p><a id="X79EC565A7DCEC938" name="X79EC565A7DCEC938"></a></p>
<h5>21.5-1 IsBound</h5>
<div class="func"><table class="func" width="100%"><tr><td classl : [ 1,2,3 ;
<p><code class="func">IsBound</code> returns <code class="/>java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
<div java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
<span class="GAPprompt">gap></span> <span class="GAPinput">l := [ , 2, 3, , 5, , 7, , , : [1, 2 ];
< class="gapgt;/>< classclass="GAPinput"IsBoundl] )</java.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85
true
<span class="GAPprompt">gap></<To think as . a names .Ancode<class""/: =""list/>< thisthat<class=">var<var>is for object var class=Arg><var> At the end the example code =code><code still thevalue <code class="code">[ 1, 2 ]</code> as this list has not been changed and nothing else has been assigned to it.</p>
false
<span class="GAPprompt">gap></span> <span class= class="example"<pre
false
</pre></div>
<p><a id="X866F45D3797FDA00" name="X866F45D3797FDA00"></a></p>
<h5>21.5-2 GetWithDefault</h5>
<div class="func"><table class="func" width="100%"><tr><java.lang.StringIndexOutOfBoundsException: Range [0, 58) out of bounds for length 0
<p><code class="func">GetWithDefault</code> returns the <var class="Arg">n</var>th element<pBut after followingexample list forwhich <code class"code">2</ode> is aname been changed the value <codeclass="ode"></code> is now <code class="code">[ 1,2 ]code./p
<p>While
betweenthe<=Arg">n<var> element being unbound,unbound or var class="rg>default</> being in var class=Arg>list</> userscancreatea mutable,such as a .< ""</>(ahref="htmljava.lang.StringIndexOutOfBoundsException: Index 443 out of bounds for length 443
< class="example"><pre>
<span class="java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
[,,"a"]
<span class="GAPprompt">gap></span> <span class="java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 0
"a"
<span java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
2
<span class="GAPprompt">gap></span> <span l1 : [ 1 ];
"a"
<span class="GAPprompt">gap></span> <span class="GAPinput">GetWithDefault(l, 4, newobj);</span>
"a"
<span class="GAPprompt">gap
true
<span class="GAPprompt">gapjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 26
l2 =
</pre></div>
<p><a id="X78B72FDF7BD63C0B" name="X78B72FDF7BD63C0B"></a></p>
<h5>21.5-3 Unbind</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&an style='color:green'>#8227; Unbind</code>( <var class="Arg">list</var>[, <var class="Arg">n</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">Unbind</code> deletes the element with index <var class="Arg">n</var> in the mutable list <var class="Arg">list</var>. That is, after execution of <code class="func">Unbind</code>, <var class="Arg">list</var> no longer has an assigned value with index <var class="Arg">n</var>. Thus <code class="func">Unbind</code> can be used to produce holes in a list. Note that it is not an error to unbind a nonexistent list element. <var class="Arg">list</var> must evaluate to a list, or to an object for which a suitable method for <code class="code">Unbind\[\]</code> has been installed, otherwise an error is signalled.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">l := [ , 2, 3, 5, , 7, , , , 11 ];;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">Unbind( l[3] ); l;</span>
[ , 2,, 5,, 7,,,, 11 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">Unbind( l[4] ); l;</span>
[ , 2,,,, 7,,,, 11 ]
</pre></div>
<p>Note that <code class="func">IsBound</code> (<a href="chap21.html#X79EC565A7DCEC938"><span class="RefLink">21.5-1</span></a>) and <code class="func">Unbind</code> are special in that they do not evaluate their argument, otherwise <code class="func">IsBound</code> (<a href="chap21.html#X79EC565A7DCEC938"><span class="RefLink">21.5-1</span></a>) would always signal an error when it is supposed to return <code class="keyw">false</code> and there would be no way to tell <code class="func">Unbind</code> which component to remove.</p>
<p><a id="X7DD65BEA7EDB0CD7" name="X7DD65BEA7EDB0CD7"></a></p>
<h4>21.6 <span class="Heading">Identical Lists</span></h4>
<p>With the list assignment (see <a href="chap21.html#X8611EF768210625B"><span class="RefLink">21.4</span></a>) it is possible to change a mutable list. This section describes the semantic consequences of this fact. (See also <a href="chap12.html#X84545F3985C60F5B"><span class="RefLink">12.5</span></a>.)</p>
<p>First we define what it means when we say that <q>an object is changed</q> in changesinteger<java.lang.StringIndexOutOfBoundsException: Index 169 out of bounds for length 169
<div class="example"><pre>
i := 3;
i := i + 1;
</pre></div>
<p>But in this example it is not the <em>integer</em> <code class="code">3</code> which is changed, by adding one to it. Instead the <em>variable</em> <code class="code">i</code> is changed by assigning the value of <code class="code">i+1</code>, which happens to be <code class="code">4</code>, to <code class="code">i</code>. The same thing happens in the example below.</p>
<div class="example"><pre>
l := [ 1, 2 ];
l := [ 1, 2, 3 ];
</pre></div>
<p>The second assignment does not change the first list, instead it assigns a new list to the variable <code class="code">l</code>. On the other hand, in the following example the list <em>is</em> changed by the second assignment.</p>
<div class="example"><pre>
l := [ 1, 2 ];
l[3] := 3;
</pre></div>
<p>To understand the difference, think of a variable as a name for an object. The important point is that a list can have several names at the same time. An assignment <code class="code"><var class="Arg">var</var>:= <var class="Arg">list</var>;</code> means in <pThismeansthat anylist <class"><var,< =><code>< =html#X846BC7107C352031"><span class="RefLink">12.7-1</span></a>) returns a mutable <em>new</em> list <var class="Arg">new</var> that is <em>not identical</em> to any other list (see <a href="chap21.html#X7DD65BEA7EDB0CD7"><span class="RefLink">21.6</span></a>), and whose elements are identical to the elements of <var class="Arg">list</var>.</p>
<div class="example"><pre>
l1 := [ 1, 2 ];
l2 := l1;
l1 := [ 1, 2, 3 ];
</re>/divjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
p afterthethe forwhich <code""l2code been and ofcode""l2 now code =c"[ 1,2 ]code>.</p>
<div class="example"><pre>
l1 := [ 1, 2 ];
l2 := l1l
l1[3] := 3;
</pre></div>
> thatlists<>/a changestheother.isincorrect <emtwo/ listsare identical, thereareactuallyonlytwo foremone/> .However the would totheconfusion.Note identical must ,becausethere onlylistwith different identity relationthatis . ofbe <code="unc>IsIdenticalObj</code> (<a href="chap12.html#X7961183378DFB902"><span class="RefLink">12.5-1</span></a>).</p>
<p>Let us now consider under which circumstances two lists are identical.</p>
<p>If you i]: [];
<div class="example"><pre>
l1 := [ 1>
l2 := [ 1, 2 ];
</pre></div>
<p>Also in the following example, no lists in the list <code class="code">l</code> are<div =""<pre
<div class="example"><pre>
l := [];
fori in[1.]do l]:[,2]od;
</pre></div>
<p>If you < ="GAPprompt">gap>/span>spanclass"GAPinput">IsIdenticalObj( list1[1], list2[1] );</span>
<div class="example"><pre>
l1 : [1 2];
l2 := l1;
</pre></div>
<p>If you pass a list as an argument, the old [ [1, 2] 3, 4] ]
<div class="example"><pre>
l1 := 12;
f := function ( l ) return l; end;
l2 := f( l1 );
</pre></div>
<p<><code class=func>tructuralCopy</ < "java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 178
<div class="<span class="GAPprompt&<><class"> ,2 ; java.lang.StringIndexOutOfBoundsException: Range [100, 99) out of bounds for length 110
l1 := [ 1, 2 ];
l2 := l1;
l1[1] := 2;
</pre></div>
<>< id"" =X7ED7C0738495556F>/a>/>
>217< classHeading"Duplication , 2] ,2]]
<p><pre><div>
<p>The subobjects (see <code class="func">ShallowCopy</code> (<p>aid="=>/>/>
<
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>In both cases, modifying the copy<> ( hcode218-\<>/java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
<p><code =funcShallowCopy/> < ".tml
<div class="example"><<p both cases copy< class"">ew/> varclass="">/>by see<"chap21.java.lang.StringIndexOutOfBoundsException: Range [264, 137) out of bounds for length 264
=]java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
for i in [ 1 .java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
if IsBound list[] then
new[i] := list[i];
fi;
od;
</pre></div>
<java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
<span class="GAPprompt">gap><pan=fi
<span ""gapg;/><">(,list2 );</span>
false
<span class="GAPprompt">gap></span> <span java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 0
true
<span class="GAPprompt">gap></span> <span class="GAPinput"=chap21.tml#X8196FD4779BCCA0C"><span class="RefLink">21.16</span></a>.</p>
[ [1, , [,
[ 0, [ 3, 4 ] ]
</pre></div>
<p><code class="<panh4. c=eading" <span>/>
<div class="example"><pre>
new :
for in[1 s""<java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 100
if IsBound( list[i] ) then
newi =( list[])
fi<>/java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 12
od;
</pre></div>
<div class="example"><pre>
<span class="GAPprompt">gap>new=]java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
<pan class=GAPprompt"gap<span><class"APinput"IsIdenticalObj )<spanjava.lang.StringIndexOutOfBoundsException: Index 100 out of bounds for length 100
false
<span class="GAPprompt">gap></<p>Suppose that <code class="func">Length/code>( ( list[])then
false
<<p>For tuning plainwe;
</<div>
[ [ 0, 2 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
</pre></div>
p <21- h5java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
div"java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 26
<span class="GAPprompt">java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
<an Gjava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 102
[ [ 1, 2 ], [ 1, 2 ] ]
<span class="GAPprompt">gap>java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[ 0,2 ] [0 2 ]]
<span class="GAPprompt">gap></span> <span class="GAPinput">list1;</span>
[ [
<<pThefunction ""/ back java.lang.StringIndexOutOfBoundsException: Range [92, 91) out of bounds for length 263
<p><a id="java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
<h4>21.8 <span class="Heading">Membership Test ass
p> id="X7B914A287F88ED0A" name="X7B914A287F88ED0A"></a></p>
<h5 ]
<div class="func"><table class ]
<p>This function call or the infix variant <var class="Arg">obj</var< =>&;/ span""><span class="GAPprompt">gap></span> <span class="GAPinput"># now l and m use the same amount of memory</span>
<p>If the list<4.< class=H> /></4>
<div class="example"><pre>
<span class="GAPprompt">gap&<5<>.- in/<java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
true
false
<span class="GAPprompt"java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
s class"">< span ""17in s; # uses binary search and only 4 comparisons</span>
false
<pre>/>
<p>For finding java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
p< ="84 ">/a<p
h4>21. <"" RepresentedLists/>/java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
<p></pre></di
<p>It would be <p>This definition will their
> the supposejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
p> .If listis java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>The result of this is of<>On other hand <p>Lists are ordered <em>lexicographicallyem.entriesaresmaller That thefollowingbehaviourLet<spanclass=SimpleMath>i/> < class""><spanjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<pjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>For fine tuning code dealing with java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p><a id="X78BF67A5802E93AD" name="X78BF67A5802E93AD"></a<> t
<h5>21.9-1 EmptyPlist</h5>
div""<
<p>Returns: a plain <h5>21.9-1 EmptyPlist</h>
<div class="func"><table class="<div class="func"><table class="func =100%<>td "java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<Rjava.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 23
pTheclass"><>/>/java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
<p>The function <code class="func">p>The function <code class="func">EmptyPlist an java.lang.StringIndexOutOfBoundsException: Range [76, 75) out of bounds for length 247
<p>Note <p>The function< class=func>ShrinkAllocationPlist/code back to <strong class="pkg">GAP</strong>'s memory manager the physical memory which is allocated for the plain list <var class="Arg">l</var>
<div class="java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
class">/>s class=GAPinput">l[>
[ ]
><<class">:())for java.lang.StringIndexOutOfBoundsException: Index 126 out of bounds for length 126
[ ]
""# now l uses about 25% more memory than the equal list m</span>
span =GAPprompt"gap&;/> <pan
<spanpFurther aboutthe of java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 125
</pre></div>
p< = "java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 62
<h4.10 <span class=Heading"Comparisons ofLists<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
p> ""< "/ar>=var =A"/><p
<p><code class="code"><var class="Arg">list1</var> <<>java.lang.StringIndexOutOfBoundsException: Range [0, 7) out of bounds for length 0
<p>Two lists <<p>< class="code"><arclass=Arg>var l;g;v java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 0
d ="java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 26
<span class="GAPprompt">gap></span> <span class="GAPinputjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<
false
class"GAPpromptgapgt</> spanclass=GAPinput"[, ,3]= ,2 ;/>
false
</pre></div>
<>Thisdefinition will problems with lists which their entries. Comparing two lists for lead kernel thelistcomparisonhas comparethe list entries which are in fact the lists themselves, and then <strong class="pkg">GAP</strong> crashes.</p>
class="Arg>/ &t; <var ; var class=""list2<var<code><p>
<p><code class="code"><var class="Arg">list1</var> <= <var <p>This definition will cause problems with lists which are their entries. Comparing lead to aninfinite recursioninthekernel the comparison tocomparejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
> ><> Unboundaresmallerthananybound .Thatimplies following < =SimpleMath>< smallest positive integer <span class="SimpleMath">i</span> such that <var class="Argjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">[ 1, 2, 3, 4 ] < [ 1, 2, 4, 8 ]; # <list1>[3] < <list2>[3]</span>
true
<<<class""< ="list1<var>&;= < class=Arg"<var<code<>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">[ 1, , 3, 4 ] < [ 1, -1, 3 ]; # <list1>[2] is unbound and thus < -1</span>
true
</pre></div>
<p>Note that forclasslt < =code>;=/>elevant mustwithcodecode&;code>whichis <m<emthe case objectsin families see<ahref"html"class"">.<span>/> thepossibility lists with ,see ahref".tml#X846063757EC05986"><span class="RefLink">13.1</span></a>.</p>
<>< id"" ""<a>/p
<h4>21.11 <span class="Heading">Arithmetic for Lists</span></h4>
<p>It
pDue intended and,thedefinitions java.lang.StringIndexOutOfBoundsException: Range [74, 73) out of bounds for length 433
<p>For example, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>For the categories and attributes
<p>For the definition of return values<iv class""<able class=func"=100"<>tdclass=tdleft"<codeclass"func">&;IsListDefault<code>( <var class="Arg">list</java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>For the <p>or list < class"Arg"list/> c "unc"IsListDefault</ indicates that the java.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 0
<p>Further details about java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>
<h4>21.12 <span Further details""<>
<p>The arithmetic behaviour of lists is controlled by their <<=X84D642967B8546B7" "X84D642967B8546B7>/</p
<p<42112 sjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
<p><a id="X87ABCEE9809585A0" name="X87ABCEE9809585A0"></a></p>
<h5>21.12-1 IsGeneralizedRowVector</h5>
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>For a list <var class="<h5>21.12-1 IsGeneralizedRowVectorh5>
<div class="example"><pre>
<span class="GAPpromptjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
true
false
<span class="GAPprompt">gap></span> <span class="GAPinput">liemat:= LieObject( [ [ 1, 2 ], [ 3, 4 ] ] );</span>
)
<span class="GAPprompt
true
</pre></div>
<p><a id="X7FBCA5B58308C158" name="X7FBCA5B58308C158"></a></p>
h5>21.122IsMultiplicativeGeneralizedRowVector</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class=<> strong =""GAP/>object < =Arg>obj<var, class="func">NestingDepthM</> <emmultiplicative nesting <em of var =Arg>obj<var> This isdefinedrecursivelyasthe integer< ="SimpleMath">0/span if<var =Argobj/var isnot in< ="">IsMultiplicativeGeneralizedRowVector/> < href".#java.lang.StringIndexOutOfBoundsException: Index 856 out of bounds for length 856
<p>For a list <var class="Arg">list</var>, the value <code class="keyw">true</code> for <code class
<div <span clas="APprompt">gap></span> <span class="GAPinput">NestingDepthA( v ); NestingDepthM( v );</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsMultiplicativeGeneralizedRowVector( liemat )1
false
<span class="GAPprompt">gap></span> <span class="GAPinput">bas:= CanonicalBasis( FullRowSpace( Rationals, 3 )<span class=>></span s =GAPinput"NestingDepthA m ) NestingDepthM;/>
CanonicalBasis( ( Rationals^3 ) )
<span class="GAPprompt">gap></span> <span class="GAPinput">IsMultiplicativeGeneralizedRowVector( java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
true
</pre></div>
<p>
p>a id=X7BAD12E67BFC90DE" name="X7BAD12E67BFC90DE"></a></p>
<h5>21.12-3 IsListDefault</<span class=GAPprompt>&;</><span <span ="GAPprompt""<span> class=estingDepthA( ); ( l1 </pan>
<div class="func"><table class="func" width="100%"><tr><td class="java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 4
<p>For a list <var class="Arg">list</var>, <code class="func">IsListDefault</code> indicates that the defaultjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
<p> [[ 1, 2],[
<p>All internally represented lists are in this category, and also all lists java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="example"><pre>
spanclass=>&;</pan java.lang.StringIndexOutOfBoundsException: Range [50, 44) out of bounds for length 101
<span class="GAPprompt">gap></span> <span class="GAPinput">IsListDefault( v ); IsListDefault( m );</span>
true
true
<span class="GAPprompt">gap></span> <span class="GAPinput">IsListDefault( bas ); IsListDefault( liemat );</span>
true
false
</pre></div>
<p><a id="X8428E77B86722D52p< ="name"A85ADC85C451DC">/a><p
<h5>21.12-4 NestingDepthA</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&an style='color:green'>#8227; NestingDepthA</code>( <var class="Arg">obj</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
pFor ""><strongobjectvar""obj<var,<ode "></code>returns > depth/>of var=Arg><var.Thisisdefinedrecursivelyastheinteger< ="">0/span if<var ="Arg">obj<var>isnotin<code =""IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>), as the integer <span class="SimpleMath">1</span> if <var class="Arg">obj</var> is an empty list in <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>), and as <span class="SimpleMath">1</span> plus the additive nesting depth of the first bound entry in <var class="Arg">obj</var> otherwise.</p>
<p><a id="X84B383B97FD986CD" name="X84B383B97FD986CD"></a></p>
<h5>21.12-5 NestingDepthM</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&an style='color:green'>#8227; NestingDepthM</code>( <var class="Arg">obj</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For a <strong class="pkg">GAP</strong> object <var class="Arg">obj</var>, <code class="func">NestingDepthM</code> returns the <em>multiplicative nesting depth</em> of <var class="Arg">obj</var>. This is defined recursively as the integer <span class="SimpleMath">0</span> if <var class="Arg">obj</var> is not in <code class="func">IsMultiplicativeGeneralizedRowVector</code> (<a href="chap21.html#X7FBCA5B58308C158"><span class="RefLink">21.12-2</span></a>), as the integer <span class="SimpleMath">1</span> if <var class="Arg">obj</var> is an empty list in <code class="func">IsMultiplicativeGeneralizedRowVector</code> (<a href="chap21.html#X7FBCA5B58308C158"><span class="RefLink">21.12-2</span></a>), and as <span class="SimpleMath">1</span> plus the multiplicative nesting depth of the first bound entry in <var class="Arg">obj</var> otherwise.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">NestingDepthA( v ); NestingDepthM( v );</span>
1
1
<span class="GAPprompt">gap></span> <span class="GAPinput">NestingDepthA( m ); NestingDepthM( m );</span>
2
2
<span class="GAPprompt">gap></span> <span class="GAPinput">NestingDepthA( liemat ); NestingDepthM( liemat );</span>
2
0
<span class="GAPprompt">gap></span> <span class="GAPinput">l1:= [ [ 1, 2 ], 3 ];; l2:= [ 1, [ 2, 3 ] ];;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">NestingDepthA( l1 ); NestingDepthM( l1 );</span>
2
2
<span class="GAPprompt">gap></span> <span class="GAPinput">NestingDepthA( l2 ); NestingDepthM( l2 );</span>
1
1
</pre></div>
<p><a id="X7E6A1F66781BE923" name="X7E6A1F66781BE923"></a></p>
<h4>21.13 <span class="Heading">Additive Arithmetic for Lists</span></h4>
<p>In this general context, we define the results of additive operations only in the following situations. For unary operations (zero and additive inverse), the unique argument must be in <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>); for binary operations (addition and subtraction), at least one argument must be in <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>), and the other either is not a list or also in <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>).</p>
<p>(For non-list <strong class="pkg">GAP</strong> objects, defining the results of unary operations is not an issue here, and if at least one argument is a list not in <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>), it shall be left to this argument whether the result in question is defined and what it is.)</p>
<p><a id="X86A85ADC85C451DC" name="X86A85ADC85C451DC"></a></p>
<h5>21.13-1 <span class="Heading">Zero for lists</span></h5>
<p>The zero (see <code class="func">Zero</code> (<a href="chap31.html#X8040AC7A79FFC442"><span class="RefLink">31.10-3</span></a>)) of a list <span class="SimpleMath">x</span> in <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>) is defined as the list whose entry at position <span class="SimpleMath">i</span> is the zero of <span class="SimpleMath">x[i]</span> if this entry is bound, and is unbound otherwise.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">Zero( [ 1, 2, 3 ] ); Zero( [ [ 1, 2 ], 3 ] ); Zero( liemat );</span>
[ 0, 0, 0 ]
[ [ 0, 0 ], 0 ]
LieObject( [ [ 0, 0 ], [ 0, 0 ] ] )
</pre></div>
<p><a id="X7B91CE4D814C2D08java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<h5>21.13-2 <span class="Heading">AdditiveInverse for lists</span></h5>
<p>The additive inverse (see java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="example"><pre>
span ">gt<span "AdditiveInverse( [1 , ];java.lang.StringIndexOutOfBoundsException: Range [115, 110) out of bounds for length 137
[ -1, -2, -3 ]
[ [ -
</pre></div>
<p><a id="X842D123E7EE5E3DB" <span="&;/>< ="> ,2 , ,4 ] ] );</java.lang.StringIndexOutOfBoundsException: Index 99 out of bounds for length 99
-3<">java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 63
="xspan span""<> class"<code < ".java.lang.StringIndexOutOfBoundsException: Index 1100 out of bounds for length 1100
<p>If <span class="SimpleMath">x</span> is in <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>) and <span class="SimpleMath">y</span> is in <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>) and has lower additive nesting depth, or is neither a list nor a domain, the sum <span class="SimpleMath">x + y</span> is defined as a list whose entry at position <span class="SimpleMath">i</span> is <span class="SimpleMath">x[i] + y</span> if <span class="SimpleMath">x</span> is bound at position <span class="SimpleMath">i</span>, and is unbound if not. The equivalent holds in the reversed case, where the order of the summands is kept, as addition is not always commutative.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">1 + [ 1, 2, 3 ]; [ 1, 2, 3 ] + [ 0, 2, 4 ]; [ 1, 2 ] + [ Z(2) ];</span>
[ 2, 3, 4 ]
[ 1, 4, 7 ]
[ 0*Z(2), 2 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">l1:= [ 1, , 3, 4 ];; l2:= [ , 2, 3, 4, 5 ];;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">l3:= [ [ 1, 2 ], , [ 5, 6 ] ];; l4:= [ , [ 3, 4 ], [ 5, 6 ] ];;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">NestingDepthA( l1 ); NestingDepthA( l2 );</span>
1
1
<span class="GAPprompt">gap></span> <span class="GAPinput">NestingDepthA( l3 ); NestingDepthA( l4 );</span>
2
2
<span class="GAPprompt">gap></span> <span class="GAPinput">l1 + l2;</span>
[ 1, 2, 6, 8, 5 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">l1 + l3;</span>
[ [ 2, 2, 3, 4 ],, [ 6, 6, 3, 4 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">l2 + l4;</span>
[ , [ 3, 6, 3, 4, 5 ], [ 5, 8, 3, 4, 5 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">l3 + l4;</span>
[ [ 1, 2 ], [ 3, 4 ], [ 10, 12 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">l1 + [];</span>
[ 1,, 3, 4 ]
</pre></div>
<p><a id="X7C3DC8BE78DEECDE" name="X7C3DC8BE78DEECDE"></a></p>
<h5>21.13-4 <span class="Heading">Subtraction of lists</span></h5>
<p>For two <strong class="pkg">GAP</strong> objects <span class="SimpleMath">x</span> and <span class="SimpleMath">y</span> of which one is in <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>) and the other is also in <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>) or is neither a list nor a domain, <span class="SimpleMath">x - y</span> is defined as <span class="SimpleMath">x + (-y)</span>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">l1 - l2;</span>
[ 1, -2, 0, 0, -5 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">l1 - l3;</span>
[ [ 0, -2, 3, 4 ],, [ -4, -6, 3, 4 ] ]
spanclass="GAPprompt"gapgt<span < class"GAPinput"l2-l4;/span>
[ , [ -3, -2, 3, 4, 5 ], [ -5, -4, 3, 4, 5 ] ]
<span class="GAPprompt">gap>java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[1, 2] [ -3 -4 ],[0 0] java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
<span class="GAPprompt">gap></span> <span class="GAPinput">l1 - [];</span>
[ 1,, 3, 4 ]
</pre>/div>
<p><a id="X782ED7F27D8C7FC1"
<h4>21.14 <span class="Heading">Multiplicative Arithmetic for Lists<iv "<pre
<p>In this general context, we define the results of multiplicative operations only in[ 2,1 ,[ 3/ /]]
<p>(For non-list <strong"=X84FDB95179BFE4CD>/a>/p>
<p><a id="X79A8A5627FD42FA5" name="X79A8A5627FD42FA5"></a></p>
<h5>21.14-1 <span java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>The one (see <code class="func">One</code> (<a [
<div class="example"><pre>
span =GAPpromptapgt<span><panclassGAPinput>ne 12 , 3,]]<
[ [ 1, 0 ], [ 0, 1 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">One( [ [ [ [ 1 ] ], [ [ 2 ] ] ], [ [ [ 3 ] ], [ [ 4 ] ] ] ] );</span>
[ [[[ 1 ] ] ] [1 ]]]]
</pre></div>
paid" =>/<p>
<h5>21.14-2 <span class="Heading
<p>The inverse (see <code class="func">Inverse</<><pthescalar i.a whose at <span class"SimpleMath"i>is< class=SimpleMath>[i <span> <spanclass=SimpleMath></> < ""i>and not/
<div class="example"><pre>
<span class="GAPprompt">gap<> ofsimplerowandjava.lang.StringIndexOutOfBoundsException: Range [84, 83) out of bounds for length 148
[ [ -2, 1 ], [ 3/2, -1/2 ] ]
</pre></div>
<p><a id="<td class=tdcenter"</
<h5>21.14-3 <span class="Heading">Multiplication of lists</span></h5>
<p>There are three possible computations that might be triggered by a multiplication</java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
<dl>
dtstrong class="()/<dt>
<dd=>L)/>
</dd>
<dt><strong class="Mark">(L)</strong></dt>
<dd><p>the left scalar multiple,<td class="tdcenter">vec/td>
</dd>
<dt><strong class="Mark">(R)</strong></dt>
<dd><p>the right scalar multiple, i.e., a class><java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
</dd>
</dl>
<p>Our aim is to generalize the basic arithmetic of simple row vectors and matrices, so we first summarize the situations that shall be covered.</p>
<div class="pcenter"><table class="GAPDocTable">
<tr>
<td class="tdcenter"></td>
<td class="tdcenter">scl</td>
<td class="tdcenter">vec</td>
<td class="tdcenter">mat</td>
</tr>
<tr>
<td class="tdcenter">scl</td>
<td class="tdcenter"></td>
<td class="tdcenter">(L<p> examplethat the product of scalar (scl with vector (ec)oramatrix (mat)iscomputedaccording to ().Note thatthis asymmetric.</p> | | |