|
|
|
|
Quelle chap21.html
Sprache: HTML
|
|
| products/Sources/formale Sprachen/GAP/doc/ref/chap21.html |
 |
< version 1. 0" "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.html">87</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
<div
<p id="mathjaxlink" class="pcenter"><aspan=>gt;</pan<class">IsTable [1] [23]] ; # not atable</span>
<p><a id="X7B256AE5780F140A" name="X7B256AE5780F140A"></a></p>
<div class="ChapSects"><a 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 class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7C4CC4EA8299701E"java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ <var class="Arg">list</var> )</td><td class="tdright">( property )</td></tr></table></div>
<span "ContSS">br/<nocss&;;/span< href"html#java.lang.StringIndexOutOfBoundsException: Range [105, 104) out of bounds for length 141
<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><a href="chap21.html#X79581E0387F7F7A9">21.1-5 IsRectangularTable</a></span>
<spanclass=ContSS>br >spanclass"" &<span>< =chap21#>21.1-6 IsConstantTimeAccessList</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X7B202D147A5C2884java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X8297BBCD79642BE6"><code>21.2-1 <span>\</span>[<span>\</span>]</code></a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X7921047F83F5FA28">21.3 <span class="Heading">List Elements</span></a>
</span>
<java.lang.StringIndexOutOfBoundsException: Range [10, 4) out of bounds for length 25
<span class="ContSS"><br /><span class="nocss"> <><id"" name""<<p
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"h4.<class""BasicOperationsforLists/span/>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&p basic forlists elementaccess(see< href"h#X7921047F83F5FA28"><span class="RefLink">21.3</span></a>), assignment of elements to a list (see <a href="chap21.html#X8611EF768210625B"><span class="RefLink">21.4</span></a>), fetching the length java.lang.StringIndexOutOfBoundsException: Index 278 out of bounds for length 0
< class"ContSS"< />span="">nbsp </span><a href="chap21.html#X795EC9D67E34DAB0">21.4-2 Add</a></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="nocss"> </span><a href="chap21.html#X7963C8E17EFF86DB">21.5 <span class="Heading">IsBound and Unbind for Lists</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X79EC565A7DCEC938">21.5-1 IsBound</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X866F45D3797FDA00">21.5-2 GetWithDefault</a></span>
< class="ContSS</<span ="nocss>nbsp;nbsp<span< href"java.lang.StringIndexOutOfBoundsException: Range [82, 81) out of bounds for length 130
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X7DD65BEA7EDB0CD7">21.6 <span class="Heading">Identical Lists</span></a>
<java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 7
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </div="func>class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ <span>\</span>[<span>\</span>]\:\=</code>( <var class="Arg">list</var>, <var class="Arg">pos</var>, <var class="Arg">ix</var> )</td><td class="tdright">( operation )</td></tr></<iv class="<java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 274
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#java.lang.StringIndexOutOfBoundsException: Index 110 out of bounds for length 0
<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 p><code class=""\\] varArg>list<>,varclass=></var> )</code isequivalent code ="< class""listvar> var class""var ]/code>, clearly will usually be preferred; the former is useful mainly if one wants to access the operation itself, for example if one wants to install a method for element access in a special kind of lists.</p>
<
<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">Comparisonsp>Analogous hold for< class""<span>/span><\<span>\\<codeand<code =func"Unbind<></pan><span></span>]</code>.</p>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.htmlh4213<span class="Heading">List Elements</span></h4>
</span>
</div>
<div class="ContSect"><span class="tocline"><span<><code =""<varclass="">list</var> var class""<>]code<p
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X87ABCEE9809585A0">21.12-1 IsGeneralizedRowVector</a></spanjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<pan="ContSS"<>spanclass=nocss>;&;</span> href".X7FBCA5B58308C158>.-2IsMultiplicativeGeneralizedRowVector/a>span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7BAD12E67BFC90DE">21.12-3 IsListDefault</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X8428E77B86722D52">21.12-4 NestingDepthA</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X84B383B97FD986CD">21.12-5 NestingDepthM</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X7E6A1F66781BE923">21.13 <span class="Heading">Additive Arithmetic<pre<div>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X86A85ADC85C451DC">21.13-1 <span class="Heading">Zero for lists</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7B91CE4D814C2D08">21.13-2 <span class="Heading">AdditiveInverse for lists</span></a>
<>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X842D123E7EE5E3DB">21.13-3 <span class="Heading">Addition of lists</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span
</span>
<divjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
<divclass"ContSect"<java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 191
<span
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X79A8A5627FD42FA5">21.14-1 <span class="Heading">One for lists</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X78C6C1E2849D303A">21.14-2 <span class="Heading">Inverse for lists</ 7]
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X84FDB95179BFE4CD">21.14-pre<div
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X82EA2A5B786181C7">21.14-4 <span class="Heading">Division of lists</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7A0FD70C80B95C00">21.14-5 <span class="Heading">mod for lists</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X84BB2DFB8432A1A4">21.14-6 <span class="Heading">Left quotients of lists</span></a>
<span>
</div></div>
<div class="ContSect"><span java.lang.StringIndexOutOfBoundsException: Range [0, 33) out of bounds for length 32
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X80FDB1457FF582E7">21.15-1 ListWithIdenticalEntries</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 0
<span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X79975EC6783B4293">21.16-1 Position</a></span>
<span class="ContSS"><br /><span class="nocss"> < class"Arg"pos/var]<code code class=code"<var ="poss<java.lang.StringIndexOutOfBoundsException: Range [142, 141) out of bounds for length 343
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7B4B10AE81602D4E">21.16-3 PositionCanonical</a></span>
<span class=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<panclass="ontSS"br/><span class""> nbsp;/span>a href=chap21.tml#>.16-PositionSorted<a<span
<span class="ContSS"><br /><span class=l[pos1]{}poss3}[pos4]{poss5}[pos6]
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X78BFE9D78347C0DA">21.16-7 PositionSet</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7FD9C1D37F300206">/pre></div>
<span class="ContSS"><br /><span
<span class="ContSS"><br /><span class="nocss"> </span><a <p>Then a selector < class=code>var ="Arg"list<var>[class=Arg"pos<var]<code> of level<varclass="Arg"level</var> is computed as <code class="code">ListElement(<var class="Arg">list</var>,<var class="Arg">pos</var>,<var class="Arg">level</var>)</code>, where <code class="code">ListElement</code> is defined as follows. (Note that <code class="code">ListElement</code> is <em>not</em> a <strong class="pkg">GAP</strong> function.)</p>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X86C9E5C3863B3C03">21.16-11 PositionBound</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X819F71047AABEA2F">21.16-12 PositionsBound</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X865EF45D87ED1384">21.16-13 PositionNot</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7F42E5AD87EC9D5A">21.16-14 PositionNonZero</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X87A8C62A867D6DA4">21.16-15 PositionSublist</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X7865747A7CCF5812">21.17 <span class="Heading">Properties and Attributes for Lists</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X83F8EC7C7BF27EFC">21.17-1 IsMatchingSublist</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7FA892828252BB3B">21.17-2 IsDuplicateFree</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7BAA9B0E81D4A884">21.17-3 IsSortedList</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X80CDAF45782E8DCB">21.17-4 IsSSortedList</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X780769238600AFD1">21.17-5 Length</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7B55FB967CDEF468">21.17-6 ConstantTimeAccessList</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X83E558E37D1B44D4">21.18 <span class="Heading">Sorting Lists</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7FE4975F8166884D">21.18-1 Sort</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X791F2B2C7E9B9A46">21.18-2 SortParallel</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X87287FCA81E2B06A">21.18-3 Sortex</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X800209E881E7CECB">21.18-4 SortingPerm</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X80ABC25582343910">21.19 <span class="Heading">Sorted Lists and Sets</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7B16AD597CB12305"><code>21.19-1 \in</code></a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7B4C0FEE7CDF6F2A">21.19-2 IsEqualSet</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X79B940567A849216">21.19-3 IsSubsetSet</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X832C23CC7FCD8892">21.19-4 AddSet</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7FCA282E789A4F4B">21.19-5 RemoveSet</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7B3469CD7EFC1A87">21.19-6 UniteSet</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X8473AA657FEC3D4D">21.19-7 IntersectSet</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X80B427537EB07D09">21.19-8 SubtractSet</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap21.html#X7DF510F7848CBBFD">21.20 <span class="Heading">Operations for Lists</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X840C55A77D1BB2E1">21.20-1 Concatenation</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7CB0A6AF87C7FAF7">21.20-2 Compacted</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7ECE9056792F28BA">21.20-3 Collected</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X8727F2928467C2F9">21.20-4 DuplicateFreeList</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7F5D4DD87E4378AC">21.20-5 AsDuplicateFreeList</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7FA272D984EF82ED">21.20-6 Flat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7C4FDB007C3F54A1">21.20-7 Reversed</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X8057372F83374193">21.20-8 Shuffle</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X8075FBDE7B81B4C8">21.20-9 Apply</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7EF6E2BC81DBF6FB">21.20-10 Perform</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X8763882A7D65F979">21.20-11 PermListList</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X82CE0DE8828E4303">21.20-12 <span class="Heading">Maximum</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X82F133EC7F89665F">21.20-13 <span class="Heading">Minimum</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X842851EB7E0969F7">21.20-14 <span class="Heading">MaximumList and MinimumList</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7E1593B979BDF2CD">21.20-15 <span class="Heading">Cartesian</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7E76F5A782184823">21.20-16 <span class="Heading">IteratorOfCartesianProduct</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7B5A19098406347A">21.20-17 Permuted</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X86CB7DCE8510F977">21.20-18 List</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7C86D7F7795125F0">21.20-19 Filtered</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X8179B13D80E935FC">21.20-20 Number</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X82801DFA84E11272">21.20-21 First</a></span>
<span class="ContSS"><br /><span class="nocss"> </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>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7AF82E747A8BDA75">21.20-24 ForAny</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7E5C72F27B657948">21.20-25 Product</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7A04B71C84CFCC2D">21.20-26 Sum</a></span>
<span class="ContSS"><br /><span class="java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 33
<span class="ContSS"</spanjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
<div></>
<div <span>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X8258477D7F72171B">21.21-1 ListX</a></span><span class="ContSS"><br />span class="">nbsp&;span>a href="chap21.#X84BB2DFB8432A1A4">21.14-6 <span class="Heading">Left quotients of lists</span></a>
<span =
<span class=""br/""&;<>a =chap21
<span<>/
<<java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
""&>href".tml#X79596BDE7CAF8491">21.22 <span class="Heading">Ranges</span></a>
/>
<div class="ContSSBlock">
spanC"br/classnocss"&;nbsp</a"java.lang.StringIndexOutOfBoundsException: Index 146 out of bounds for length 146
span"<span class="ContSS"
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap21.html#X7D22B2298167A58F">21.22-3 ConvertToRangeRep</a></span>
<div>/div>
<iv class""<pan ""spanclass=""&</span< ="chap21.java.lang.StringIndexOutOfBoundsException: Range [167, 115) out of bounds for length 167
<
<div class="ContSSBlock">
spanclass">br/< class""><iv class="ample><re
<><div>
<div class=" class""< >span class"ocss"&;nbsp<span< =chap21.#X86C9E5C3863B3C03">21.16-11 PositionBound</a></span>
<
<div class="ContSSBlock">
="nocss"> ;/>ahref=chap21html#X8438CB908367254C">21.24-1 PlainListCopy</a></span>
<span class="<span class="ContSS> >s"ocss"nbsp;nbsp;/>ahref".#X7F42E5AD87EC9D5A">21.16-14 PositionNonZero</a></span>
<div><divjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
</<ivclassContSect< class""<span =ocss>nbsp;span< =chap21.#X7865747A7CCF5812">21.17 <span class="Heading">Properties and Attributes for Lists</span></a>
<h3>21 <span class=<pan class""< class">< class"rg><var>< "">pos</>]=< =<</a></span>
<>Listsare most way treat java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 12
<p>This chapter deals mainly with/>
<p>Lists are used to <span class="ContSS"><br /><span>nbsp list[s =;
<p>Severalelse
< for< class=>< > class=nocss>nbsp&<>ahref=java.lang.StringIndexOutOfBoundsException: Range [82, 81) out of bounds for length 136
<h4>anjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
span=ContSS"< >span =nocss"&bsp&<span>a href="chap21.html#X7B4C0FEE7CDF6F2A">21.19-2 IsEqualSet</a></span>fi;
<div class="example<pan class=ContSS"< /span=""&bsp;nbsp;/< hrefjava.lang.StringIndexOutOfBoundsException: Range [0, 81) out of bounds for length 12
<span class="GAPprompt">gap></span> <span class="GAPinput">[ 1, 2, 3 ]; # a list with three elements</span>"/> =< ="><<code>f java.lang.StringIndexOutOfBoundsException: Range [148, 147) out of bounds for length 543
,2 3 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">[ [], [ 1 ], [ 1, 2 ] ]; # a list may contain other lists</span>
[ [ ], [ 1 ], [ 1, 2 ] ]
</pre></div>
p isjava.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 133
<>a=X7C4CC4EA8299701Ename" =als;
<h5>21.1-1 IsList</h5>
<div class="func"><table class="func" ""< /<class="nocss&bsp&;/java.lang.StringIndexOutOfBoundsException: Range [0, 65) out of bounds for length 54
<p>tests whether <var class="Arg"< classContSS> >span=nocss"&&;<span>a=".tml
<div class="example"><pre>
<span< ="<br/<class="ocss>nbsp&<span<<span class="ContSS"><br /><span class="nocss"> </span><a
rue
/<div>
p< idX870AA9D8798C93DD5>code>21.-\\}=code><h5java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
<h5>21.1sclass=ContSS>br< ""class"width100>>tdclass=tdleft>cclass=">‣ \{\}\:\=</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>
<div class="func">< class"""%>trt =tdleft"< =f"&8227 /> v "Arg>< <<djava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<<class""<""&;nbsp<java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 174
<> > ""&;&<<".htmljava.lang.StringIndexOutOfBoundsException: Index 134 out of bounds for length 134
""ap;/>s class=GAPinput>IsDenseList ,2 ;/pan>
true
< ""gapgt;<span s =GAPinput> :=[, 4,<addselement< ""obj<> listvar=""<The adds<class=>obj/>atthe of< ="Arg>list/var i.e. it java.lang.StringIndexOutOfBoundsException: Index 213 out of bounds for length 0
false
n&java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 130
9
<span class="GAPprompt">gap></span> <span class="GAPinput"><
Element&l;4must an
not < ">br/<pan class="ocss"&&;/pan><
<h5>214-Remove<java.lang.StringIndexOutOfBoundsException: Index 183 out of bounds for length 183
you cans java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
you can 'return<span =">br/<class the removedelement.In this case <var class="Arg">list</var> must be non-empty.</p>
<span class="GAPbrkprompt">brk></span> <span class="GAPinput">l[4] := 16;; # assigning a value</span>
<span class<pThetwoargument <>
16
gap>
</pre></div><>
pbserve ode"">l[4<code,whichnot the <class"></code-( ".#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>
<p><a< =ContSS>br >class">nbsp/>java.lang.StringIndexOutOfBoundsException: Range [142, 68) out of bounds for length 142
<h5>21.1-3 IsHomogeneousList</h5>
<[2, < =ContSS> /< ">nbsp&<span>hrefhap21#X7BB462C17962647F">21.23-1 IsQuickPositionList</a></span>
<r code class=spanclass=GAPprompt>></><class=GAPinput>(,2) l<span>
<p>A class""br/<class"ocss>nbsp&bsp;span< href=chap21html#X8438CB908367254C">21.24-1 PlainListCopy</a></span>
class""rejava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
<span class="GAPprompt">gapjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
true
true
<span class="GAPprompt">gap&<spanclass<p>Listsarethemost way togetherAemlistem in definiteorderSolist from to e is ofa,a,a soon can immutableformseeahref"html
false
</pre></div>
<p><a id<>aid="java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 62
<h5>21.1-4 IsTable</h5>
<div codeclassjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
p >tableem is list homogeneouswhichlieinthe family.Typicalexamplesof (ee a =".html#X812CCAB278643A59"><span class="RefLink">24</span></a>).</p>
<div
<span =GAPprompt"gapgt</> span class=GAPinput" theoperations < =unc>/ <a href=chap21.java.lang.StringIndexOutOfBoundsException: Range [318, 152) out of bounds for length 318
true
<span class="<p>A list can be writtenbywriting down the elements order <p>A list can be written by writing down the elements in order between
true
<spanclass=GAPprompt>gap>java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
false
/pre>/java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 12
<p><a id [ ] ,2< class"">tableclass""width=100%>tr<d "<>divjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
1 java.lang.StringIndexOutOfBoundsException: Range [31, 29) out of bounds for length 34
<div class=
> in class"">/> itis elements homogeneouslistsof the samepwhether<var"Arg><> <pjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
"""<>/
<>116 IsConstantTimeAccessList/h5>
div=func"< ==func"=100">trtdclass"">codeclass"func"&8227; IsConstantTimeAccessList</code>( <var class="Arg">list</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p<span "gapgt</pan <panclass="APprompt"g>/>< =GAPinput"(l,[, 23 )l</>[ 2 3,5,7 11 13 , 23]
<p>But also other enumerators (see <a href="chap21.html#X7EA3ACE27E43D174"><span class="RefLink">21.23</span></a>) can lie in this category if they guarantee constant time access to their elements.</p>
<p><a id="X7B202D147A5C2884" name="X7B202D147A5C2884"></a></p>
<h4>21.2 <span class="Heading">Basic Operations for Lists</span></h4>
forlists elementaccess(< "h#X7921047F83F5FA28"><span class="RefLink">21.3</span></a>), assignment of elements to a list (see <a href="chap21.html#X8611EF768210625B"><span class="RefLink">21.4</span></a>), fetching the length of a list (see <code class="func">Length</code> (<a href="chap21.html#X780769238600AFD1"><span class="RefLink">21.17-5</span></a>)), the test for a hole at a given position, and unbinding an element at a given position (see <a href="chap21.html#X7963C8E17EFF86DB"><span class="RefLink">21.5</span></a>).</p> inany java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
mbasicoperation name""<a<p>
<p>Any <strong class="pkg">java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
<p>For java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
p< id=div=func<class""width="%>tr< =tdleft>code=func>#8227; IsBound</code>( <var class="Arg">list</var>[, <var class="Arg">n</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<h5><code>21.2-1 <span>\</span>[<span>\</span>]</code></h5>
=func>tableclass=funcwidth"%>div java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 26
<span="gapgt<span < "IsHomogeneousList [ ,2 ; ([ )<spanjava.lang.StringIndexOutOfBoundsException: Index 128 out of bounds for length 128
<div class="func"><pan class""<> =>([ 1 false (]);/pan
p< id"X80872FAF80EB5DF9"name"">/a>p>
<<>.4IsTable/h5>
<p>Note that the special characterss class=GAPprompt>&<span> <pan =GAPinput"IsBound [101])<span>
<p><code class="code">\[java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
<p>Similarly, <code
<p>Analogous statements hold for <code class="func"><span>\</span>[<span>\</span>]\:\=</code> and <code class="func">Unbind<span>\</span>[<span>\</span>]</code>.</p>
<p><a id="X7921047F83F5FA28" name="X7921047F83F5FA28"></a></p>
<h4>21.3 <span class="Heading">List Elements</span></h4>
p><ode class=code"<var class=Arg>list<java.lang.StringIndexOutOfBoundsException: Range [0, 48) out of bounds for length 0
<p>Theaboveconstructjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="example"><pretrue
<span class="GAPprompt">gap>< class="APprompt">></span> <span class=<div class="func"><table class="func" width="100%"><tr><td"""code classf>8227 GetWithDefault</ode( varclass=>list<var,varclass"Arg"n<var> <ar classArg"default/>)td>td class=tdright> &)/td<>/table</ivjava.lang.StringIndexOutOfBoundsException: Index 283 out of bounds for length 283
2
3
13
> <class""list<> -java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pc =ode>var=list/> ""/java.lang.StringIndexOutOfBoundsException: Range [78, 77) out of bounds for length 91
<p>java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<divclass=example"><>
<span class="GAPprompt">gap></<span class=GAPprompt">gap></span> <span class="GAPinput">l := [1,2,,"a"];</span>
span ="GAPprompt"gapgt<span>< class=GAPinput">l{[4..6]}; l{[1,7,1,8]};</span>
[ 7, 11, 13 ]
[ ,17,2,19]
</pThis categoryindicates the toeach element of <ar ="list<var>[,2,"java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
pTheresult class="GAPprompt">&;span>span="Gjava.lang.StringIndexOutOfBoundsException: Range [77, 76) out of bounds for length 98
<<
<> element access see< href.#"ajava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
classjava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 137
<span class="GAPpromptjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[ [ 7, 8, 9 ], [ 4, 5,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<re>div>
<p< =true
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="examplediv""<tableclass"func" width"100%>tr><dclass=tdleft><class"">&='color:green'>#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>
l[pos1]{poss2}{poss3}[p< =unc"<class" width=100"tr>=tdleft"codeclass="func">#
level 0 0 1 2< ="func"><table class="func" width="100%">tr<td class=tdleft"<codeclass"func"&8227 <span\/span>[<span>\<span<code(
</pre></div>
<p>Then a java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
<div class="example"><pre>
ListElement<codeclass""Unbindcodedeleteselementindex<arclass=rg><>in list< class"Arg"list/var> is,afterexecution of code class=func>Unbind</ode, var =""></var>no hasanassigned value withindex <arclassjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return list[pos];
else
return List( list, elm -> ListElement(elm,pos,level-1) );
fi;
end;
</pre></div>
pandaselector < => =Arg"/>{<varclass""possjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="example"><pre>
level )
level =0then
return list{poss">prejava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
else
return List( list, elm -> java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
fi;pIfvar=Arg" 2,,,7,,11 java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
end;
<pre>/divjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
<><a <Notethat< =func><code a =chap21.tml#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>
<h5><code>21.3-1 \{\}</code></h5>
<div class="func"><table class="<p>The result is a <em>new</em> list that is not identical toany other java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<> nest emextractionsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<<java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 26
<h4>21.4 <span class="Heading">java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 32
7, 8, 9 ], i : 3java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
> assigns theobjectvarclassArg><var>,whichcan java.lang.StringIndexOutOfBoundsException: Range [97, 96) out of bounds for length 465
<div class="example"><pre>
ap&<span> <panjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
s class"">>/ < java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[ 3, 2, 3
<span lass=example><rejava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
[ 3, [ 4, 5, 6 ], 3 ]
spanclass=>paselector<class""<Arg><varvclassrg>/><> ""level<var> iscomputedas<ode class=code"ListElement<ar class=Arg"<var,varclass=Arg"><var><class"Arg"level<var><<>>
[ 3, [ 4, 5, 6 "<<Thejava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 234
</pre></div>
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dclass=example"><>
<span class="return List( list, elm&;java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 62
[ 3, [ 4, 5, 6 ], 10, "
<class""java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[
/re/>
<p if
<> assigningre
> varclassArglist/> toa list < class"">pos/> not toapositiveintegermethodselection is invokedjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
<p><code class="code"><var class="Arg"><pre><div>
<p>The sublist java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class=h4214span class"> Assignment/span<>
<span class="<>codeclass=>var =Arg>list</var>[< class=Arg"ix/>]: var class""object/var;/code>pjava.lang.StringIndexOutOfBoundsException: Index 123 out of bounds for length 123
< java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[ 10, 11, 12, 13, 11, 13, 17, 19 ]
< class=GAPprompt">gapgtl1:= 1 ;
[ 3,spanclass"">gap><span span "l[1 =3;:l1
//>
<p>The next example shows that it is
<div class="example"><pre>
<span class=
span""gap;/pan> span class="java.lang.StringIndexOutOfBoundsException: Range [66, 63) out of bounds for length 124
</pre></ ,[,, ,," entry]
<p>The exact behaviour is [ 3, [ 4, 5, 6 ], 10, "another en"<Ifyou thelistdenoted this literal a listthat not identical any list.Thus inthe following <ode ""l1 code=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="example"><pre>
assigning a list the , mutables < =chap12h#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>
0 1 1 2
</pre></div>
<<pThe assignment assigns object codeclass="ode"< class="Arg"<>lso the example,nolists the < class""l/ode .</p>
<div class="example"><pre>
ListAssignment := function ( list, pos, vals, level )
local i
iflevel=0
list[pos] := vals;
else
iin[.Length)] do
ListAssignment(listi],pos, vals[i], level-1 );
od;
fi;
endjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
</pre></div>< class=example"><pre
<p>and a list assignment <code class="code"><var class="Arg">list</var>{<var class="Arg">poss</var>} := <var class="Arg">vals</var></code> of level java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
divclass=example"<>
ListAssignments := function ( list, poss, vals, level )
local i;
if level = 0 then
list{poss} := vals;
else
for i in [1..Length(list)] do
ListAssignments( list[i], poss, vals[i], level-1 );
od;
fi;
end;
</pre></div>
<p><a id="X813FF1637F8D2B7F" name="X813FF1637F8D2B7F"></a></p>
<h5><code>21.4-1 \{\}\:\=</code></h5>
<div class="func"><table class="func" width="100%"><tr><td class="java.lang.StringIndexOutOfBoundsException: Range [0, 72) out of bounds for length 0
<p>This operation implements sublist assignment. For any list,l1 : [1 2 ]
<p><a id="X795EC9D67E34DAB0" name="X795EC9D67E34DAB0"></a></p>
<h5>21.4-2 Add</h5>
<div class=
<p>adds the element <var class="Arg"><pIfyouchangea keepsitsidentity. Thus iftwo are identical and you change ofthem,youalsochange the other,andtheyare still identical afterwards.Onother , lists that are not identical will never become identical if you change one of them. So in the following example both <code class="code">l1</code> and <code class="code">l2</code> are changed, and are still identical.</p>
<p>The three argument version adds <var class="Arg">obj</var> in position <var class="Arg">pos</var>, moving all later elements of the list (if any) up by one position. Any holes at orjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>Nothing is returned by <code class="func">Add</code>, the function is only called for its side effect.</p>
<p><a id="X7E98B11B79BA9167" name="X7E98B11B79BA9167"></a></p>
<h5>21.4-3 Remove</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><>< id=X7D7C0738495556F" name="X7ED7C0738495556F"></a></p>
<java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
<>heoneargument returns .thiscase<var ="rg>ist<var>non-empty.<pjava.lang.StringIndexOutOfBoundsException: Index 124 out of bounds for length 124
<p>The two argument form returns the old value of <p meaning<ode"func">ShallowCopy</code> (<a href="chap12.html#X846BC7107C352031"><span class="RefLink">12.7-1</span></a>) and <code class="func">StructuralCopy</code> (<a href="chap12.html#X7C1E70587EBDD2CB"><span class="RefLink">12.7-2</span></a>) for lists. For the general definition of these functions, see <a href="chap12.html#X786B942B82D684BD"><span class="RefLink">12.7</span></a>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">l := [ 2, 3, 5 ];; Add( l, 7 ); l;</span>
[ 2, 3, 5, 7 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">Add(l,4,2); l;</span>
[ 2, 4, 3, 5, 7 ]
<span class="java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
4
[ 2, 3, 5, 7 ]
<span </pre></div
7
[2 3 5]
<span class="GAPprompt">gap></span> <span class="GAPinput">Remove(l,5); l;</span>
[ 2, 3, 5 ]
</pre></div>
<p><alocal java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
<h5>21.4-4 CopyListEntries</h5>
<div class="func"><table class="func" width="100 ListAssignment(list[i], pos,vals[i] level1)
<p>;
p =func><codeisused methodsfortheoperations code class=func><code =c.html#X795EC9D67E34DAB0"><span class="RefLink">21.4-2</span></a>) and <code class="func">Remove</code> (<a href="chap21.html#X7E98B11B79BA9167"><span class="RefLink">21.4-3</span></a>).</p>
<p><a <iv ="xample"><pre>
21-<
<div level=0 then
<ListAssignments(list[i, i], level- );
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
<div classjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<pan ="APprompt">gap></span> <span class="GAPinput">l := [ 2, 3, 5 ];; Append( l, [ 7, 11, 13 ] ); l;</span>
[ 2, 3, 5, 7, 11, 13 ]
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
2,3 5 7 11,13, 17, 23 ]
</pre></div>
<>< id=X7963C8E17EFF86DB"name"X7963C8E17EFF86DB">/><pjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
<h4>21java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p><a id="
<h5>21.5-1 IsBound</h5>
class"func"width""<><tdclass="tdleft">codeclass="func"‣ IsBound</code>( <var class="Arg">list</var>[, <var class="Arg">n</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
p< ="">IsBound</returns<code =keyw"true/code>ifthe <arclass"Arg>list<var anelement at index < class=Arg"n</var> and<code class="eyw>false/>otherwise <var class="Arg>list<var> must evaluate to a list,or object which suitable method for code class="code>IsBound[]/code has been , an error issignalled</
<div class="example"<java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
span class=GAPprompt>gap&t</pan <panclass="GAPinput">l := [ , 2, 3, , 5, , 7, , , , 11 ];;</span>
<span class="GAPprompt">gap></span> <<>a id="X7E98B11B79BA9167" name="X7E98B11B79BA9167"<a<
rue
<span class="GAPprompt">gap></span> <span class="GAPinput">IsBound(< class=func>tableclass"" width"100%>tr<td=tdleft>codeclass="func"‣ Remove</code>( <var class="Arg">list</var>[, <var class="Arg">pos</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
false
<
false
</pre></div>
p< "" =">a>p>
<h5>21.5-2 GetWithDefault</h5>
< class=func>tableclass=func" =100">tr< class=tdleft< class=func>#8227;GetWithDefault</> var class="Arg">list</var>, <var class="Arg">n</var>, <var class="Arg">default</var> )</td><td class="tdright">( operation )[2 3,5,7]
<p><code class="func">GetWithDefault</code> returns the <var class="Arg">n<span class"APprompt"gapgt<span <pan ="GAPinput">emove(l,);l;<span>
<p>While this method can be used on any list, it is particularly useful for Weak Pointer lists <a href="chap86.html#X86D963DC7968899B"><span class="RefLink">86.1</span></a> where the value of the list can change.</p>
distinguish between the < class=""></> elementbeing unbound, or< =Arg"default</var> being in <ar class"">list</var>, userscan createa new mutable object such as a string. codeclass="func"IsIdenticalObj/> (a ="chap12#">spanclass=RefLink">12.-1/pan>/> < class""false<code java.lang.StringIndexOutOfBoundsException: Range [394, 393) out of bounds for length 443
classexample">java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
<">gap></span> <span class="GAPinput">l := [1,2,,"a"];</span>
[ 1, 2,, "a" ]
<span class="GAPprompt">gap></span> <span class="GAPinput">newobj := "a";</span>
"a"
<span class="GAPprompt">gap></span> <span class="GAPinput"><div class"">class""width"100%><r>< =">code class="func">‣ CopyListEntries</code>( <var class="Arg">fromlst</var>, <var class="Arg">fromind</var>, <var class="Arg">fromstep</var>, <var class="Arg">tolst</var>, <var class="Arg">toind</var>, <var class="Arg">tostep</var>, <var class="Arg">n</var> )</td><td class="tdright">( function )</td></tr></table></div>
2
<span class="GAPprompt">gap></span> <span class="GAPinput">GetWithDefault(l, 3, newobj);</span>
"a"
<span class=GAPprompt>gapg;<span spanclass"GAPinput">etWithDefault(l, 4, newobj);</span>
"a"
<span class="GAPprompt">gap></span> <span class="GAPinput">IsIdenticalObj(GetWithDefault(l, 3, newobj), newobj);</span>
true
<span class="GAPprompt">p>aid"X79E31DB27C82D6E1" name=X79E31DB27C82D6E1>/>/java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
false
</pre></div>
<p><a id="X78B72FDF7BD63C0B" name="X78B72FDF7BD63C0B"></a></p>
h>.5-3 Unbind</>
<div class="func"><table class="func" width="100%"><tr><<p>adds the elements of the list <var class="Arg">list2</v the of the mutable varclass"Arg></var ahref=".#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><code class="func">Unbind</code> deletes the element with index <var class="Arg">n</var> in the mutable java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="example"><pre>
<ivclass=example">pre
[ ]
< l[4] ); l;</span>
[ , 2,,,, 7,,,, 11 ]
</pre></div>
<p>Note <java.lang.StringIndexOutOfBoundsException: Range [22, 5) out of bounds for length 97
<p><a id="X7DD65BEA7EDB0CD7" name="java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 31
<h4>21.6 <span class=<pre</iv>
<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>. You may think that in the following example the second assignment changes the integer.</p>
<div class="example"><pre>
i := 3;
i := i + 1;
</pre>/>
<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 assigningthe of <codeclass=""i+</ode> happens to be <code class="code"4<code>, <ode =code">i/ode>.The thing in theexample below.</p>
<div class="example"><pre>
l := [ 1, 2 ];
: ]java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
<pre>/div>
<p>The second assignment does not change the first list, instead
<div class="example"><pre>
l: ;
l[3] :span class=GAPprompt">&<span> span class">( [7 ;span>
</pre></div>
p> understandthedifference, think of avariableas anameforan object Theimportantpointisthat listcanhaveseveralat the same time An assignment <code class="">var =Arg>var<var>=<var classArg></var;</code>meansin this interpretation that var =Arg>var/ a namefor theobject< ""list<. of following<code class="class"ode"l2/>stillhas java.lang.StringIndexOutOfBoundsException: Range [452, 451) out of bounds for length 566
<iv>>
l1 := [ 1, 2 ];
l2 := l1;
l1 := [ 1, 2, 3 ];
> the the <=l/ has andthustheof< ">l2 ,3 </code></>
<div class="example"><pre>
l1 := [ 1, 2 ];
l2 := l1;
l1[3] := 3;
</<p>Todistinguish var class"">/varthelement ,<""varbeing< ""var> can a new object such string codeclass=func>IsIdenticalObj<code < =chap12.#X7961183378DFB902"><span class="RefLink">12.5-1</span></a>) returns <code class="keyw">false</code> for different mutable strings, even if their contents are the same.</p>
<p>We<iv class=""<pre>
<p> 1, 2,a
<p>Ifa"
<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 identical.</p>
<div class="example"><pre>
l := [];
for i in [1..10] do l[i] := [ 1, 2 ]; od;
</pre></div>
<p>If you assign a list to a variable no new list is created. Thus the list value of the variable on the left hand side and the list on the right hand side of the assignment are identical. So in the following example <code class="code">l1</code> and <code class="code">l2</code> are identical lists.</p>
<div class="example"><pre>
l1 := [ 1, 2 ];
l2 : l1;
</pre></div>
<p>If you pass a list as an argument, thejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
< example>pre>
l1 := [ 1, 2 ];
f := function ( <div class=examplepre>
l2 := f( l1 );
</pre></div>
<p> ,2, , ]
java.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 26
l1 := [ 1, 2 ];
l2 := l1;
l1[1] <h4>21. span =">java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 22
/>/
<< ""java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 62
<h4>21.7 <span class="Heading">Duplication of Lists</span></h4>
<p
pThesubobjects(see<5<21.-- i<</>
<p>This means that for any list <varjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
>In ,modifyingthecopy varclass=Argn<var resp.< Arg">scp<var assignments( a href=html#X8611EF768210625B"><span class="RefLink">21.4</span></a>) does not modify the original object <var class="Arg">list</var>.</p>
<pnew: [;
<div class="example">< if IsBound( list[i] ) th( i)then
new := [];
for i in [ 1 .. Length( list ) ] do
if class"GAPprompt"gapgt< class">1 2, 2 1 3] 1in java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
new[i] := list[i];false
java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 5
od;
</pre></div>
<div class="java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
<span class="GAPprompt">gap></span> <span class="GAPinput">list1 := [ [ 1, 2 ], [ 3, 4 ] ];; list2 [1,2][3java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
s<>21< classHEnlargingLists>/>
false
<span class="GAPprompt">gap&<pSection< java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
rue
pan=GAPprompt>>span span class=>[]:=0; ; list2;span>
[ [ 1, 2 ], [ 3, 4 ] ]
[ []: StructuralCopylist[ )
<re>/>
<p><code
<div class="example"><pre>
: [;
for i in [ 1 .. Length( list ) ] do
IsBoundi)
new[i] := StructuralCopy( list[i] );
fi;
od
<pre>/divjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
<div class="example"><pre>
<span class="GAPprompt">gap<>Theabove<>.1EmptyPlist<h5>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsIdenticalObj
false
<span class="GAPprompt">gap></span> <span class="GAPinput">IsIdenticalObj( list1[1], list2[1] );</span>
false
<span class="GAPprompt"<<"">&t</ class"> =java.lang.StringIndexOutOfBoundsException: Range [96, 85) out of bounds for length 102
[ [ 1, 2 ], [ 3, 4 ] ]
[ [ 0, 2 ], [ 3, 4 ] ]
</pre></div>
> code class=func><codegives to strong =""GAP/trong' the physical allocated the plain list <var class="Arg">l</var> but not needed by the current number of entries.</p>
<div class="example"><pre>
ass
<span class="GAPprompt">gap>
[ [ 1, 2 ], [ 1, 2 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">list2[1][1] := 0;; list2;</span>
[ [ 0, 2java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
<span class="GAPprompt">gap></<span class="GAPprompt">gap></span=java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 125
[ , ]java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
<p><a id="X808A207182B2F84F" name="X808A207182B2F84F"></
<4>21. span class"eading">MembershipTest forLists<span></4>
<p><a id="X7B914A287F88ED0A" name="X7B914A287F88ED0A"></a></p
h><code>2181 \<code>/h5>
djava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 4
<p>This function call or the infix <p>Two lists <var class="Arg">list1</varand< =Arg>> forindexsclassSimpleMath>span java.lang.StringIndexOutOfBoundsException: Range [171, 170) out of bounds for length 523
<p<<div>
<div class="example"><pre>
<span classjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
true
false
<span<>21. <pan class=Heading>EnlargingInternally Represented Lists<span<h4>
<span class="GAPprompt">gap></span> <span class="GAPinput">17 in s; # uses binary search and only 4 comparisons</span>
false
</prespan =GAPprompt>&<span><pan "> 1 ,3 ] 3, 2, 1]<span>
<p>For finding the position of an element
<p><a id="X84D6FC7E7E39ED33" name="X84D6FC7E7E39ED33"></a></p>
<h4>21.9 <span class="java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<<pOn otherhand every assignment beyondjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<Sothefollowingstrategyisused a createdjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0
p the/ any .java.lang.StringIndexOutOfBoundsException: Range [104, 103) out of bounds for length 1003
<p>So the following strategy is used. If a list is created it is created with exactly the correct size<
<>The of java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 476
<> that< "">/code (a =
pFor fine tjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
<p><a id="
5java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
"width=100%>tr<td class="dleft
<p>Returns:<>thatfor lists <ode code"lt<code>or code <>eturns: nothing</p>
<div class="func<> function <code class=func"><a id="X845EEAF083D43CCE" name="X845EEAF083D43CCE
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<</code>returns empty plain list which has java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
code"func"<>givesjava.lang.StringIndexOutOfBoundsException: Range [77, 74) out of bounds for length 263
Nthere functions code class""/ode>(a =chap27.#X836078DC829A8221>spanclass"java.lang.StringIndexOutOfBoundsException: Index 139 out of bounds for length 0
""java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 26
""gg;/>"";pan">l:=[:=]; for i in [1..160] do Add(l, i^2); od;</span>GEmptyPlist160;.] m ^;od<>
[ ]
G"gapgt<>span<span class="GAPprompt">gap></span> <span class
[ ]class""><span<pan
span=GAPprompt>g<span spanclass="GAPinput"># now l uses about 25% more memory than the equal list m</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">ShrinkAllocationPlist(l);</span>
<span class="GAPprompt">gap><<><aid"X8016D50F85147A77" name=<p><a id="X84D642967B8546B7" name="X84D642967B8546B7a></java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
</pre></div>
<p>java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<h4>21.10 <span class
<
pcode"< ""list1</>&t&t <ar java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 0
<d =<>
d java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 26
span=GAPprompt>gap>/ span class=GAPinput[1, , 3]=[,2,3]<span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">[ , 2, 3 ] = [ 1, 2, ];</span>
false
<span class="GAPprompt">gap></span> <span class="GAPinput">[ 1, 2, 3 ] = [ 3, 2, 1 ];</span>
false
</pre></div>
own two such lists for equalitymay if list has java.lang.StringIndexOutOfBoundsException: Index 202 out of bounds for length 0
<p><code class="code"><var class="Arg">list1</var> < <var class="Arg">list2</var></ <>istsem/ java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 1003
<>code =code>varclass=Arg>list1< lt= var">list2/var>/><pjava.lang.StringIndexOutOfBoundsException: Index 96 out of bounds for length 96
<p>Lists java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">[<pan class="GAPprompt">gap></span> <span class="GAPinput">IsMultiplicativeGeneralizedRowVector( liemat );</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">[ 1, 2, 3 ] < [ 1, 2, 3, 5 ]; # <list1>[4] is unbound and thus < 5</span>
true
spanGAPpromptgap</span> =GAPinput> 1 ,4 ] < ,-,3]# &list1[]is unbound thus &;-1<span>
true
</pre></div>
>thatfor two <""&;/>(elevant be codeclass"">lt</> usually e>not/> the for different families,see href=chap13.#X846063757EC05986><span =RefLink131/<a.Alsofor to compare other objects see < =chap13.java.lang.StringIndexOutOfBoundsException: Range [499, 455) out of bounds for length 499
<p><a id="X845EEAF083D43CCE" name=java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
<h4>21.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<pNotethe""(to generalityflexibility definitionsgiveninthefollowingsectionsare technical Butfor complicated suchas (ee < href"chap24.html#X7899335779A39A95"><span class="RefLink">24.3</span></a>) and row vectors (see <a href="chap23.html#X85516C3179C229DB"><span class="RefLink">23.2</span></a>) whose entries aren't lists, the resulting behaviour should be intuitive.)</p>
<p>(Due to the intended generality and flexibility, the definitions given in the following sections are quite technical. But for not too java.lang.StringIndexOutOfBoundsException: Index 146 out of bounds for length 0
<p>For example, we want to deal with matrices which can be added and multiplied in the usual way, via the infix operators <code class="code">+</java.lang.StringIndexOutOfBoundsException: Index 147 out of bounds for length 0
<p>For the categories and attributes that control the arithmetic behaviour of lists, see <a href="chap21.html#X84D642967B8546B7"><span class="RefLink">21.12</span></a>.</p>
<p>For definition valuesofadditiveand whose listsin filters a ="hap21.tmlX7E6A1F66781BE923"><span class="RefLink">21.13</span></a> and <a href="chap21.html#X782ED7F27D8C7FC1"><span class="RefLink">21.14</span></a>, respectively. It should be emphasized that these sections describe only what the return values are, and not how they are computed.</p>
<
<p> classjava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 26
<p>aid=" name=""</a>/p>
h>. <pantrue
<p>Thespanjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p><a id="X87ABCEE9809585A0" name="X87ABCEE9809585A0"></a></p>
</h5
<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>For
<div class
< ""gapgt;/pan "gapgt;/< class=GAPinput>(); java.lang.StringIndexOutOfBoundsException: Range [99, 97) out of bounds for length 111
true
false
class">&;/s
LieObject([ 1 ] java.lang.StringIndexOutOfBoundsException: Range [24, 0) out of bounds for length 0
<span class="GAPprompt">gap></span<> a<strongclass=pkg>GAP/> < class=Arg>/> <odeclass=func"NestingDepthA</ the<emadditivenesting <em < class""obj/> spanclassSimpleMath<> class/ classfunc>java.lang.StringIndexOutOfBoundsException: Range [351, 350) out of bounds for length 816
true
/></java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 12
pa=X7FBCA5B58308C158"name"></<p>
<h5>21.12-2 IsMultiplicativeGeneralizedRowVector</h5>
lass"">table ="func"width=100"<tr<class"tdleft"<code class=func>‣ IsMultiplicativeGeneralizedRowVector</code>( <var class="Arg">list</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>For a list <var class="Arg">list</var>, the value <[ [ 1, -2 ] -3 ]
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsMultiplicativeGeneralizedRowVector( liemat );</span>
false
<span class="GAPprompt">gap></span> <span class="GAPinput">bas:= CanonicalBasis( FullRowSpace( Rationals, 3 ) );</span>
CanonicalBasis( ( Rationals^3 ) )
<span class="GAPprompt">gap&
true
</pre></div>
<p>Note that the filters <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>), <code class="func">IsMultiplicativeGeneralizedRowVector</code> do <em>not</em> enable default methods for addition or multiplication (cf. <code class="func">IsListDefault</code> (<a href="chap21.html#X7BAD12E67BFC90DE"><span class="RefLink">21.12-3</span></a>)).</p>
<p><a id="X7BAD12E67BFC90DE" name="X7BAD12E67BFC90DE"></a></p>
<h5>21.12-3 IsListDefault</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&an style='color:green'>#8227; IsListDefault</code>( <var class="Arg">list</var> )</td><td class="tdright">( category )</td></tr></table></div>
<>For< class"Arg">list</var>, <code class="func">IsListDefault</code> indicates that the default methods for arithmetic operations of lists, such as pointwise addition and multiplication as inner product or matrix product, shall be applicable to <var class="Arg">list</var>.</p>
<p><code class="func">IsListDefault</code> implies <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>) and <code class="func">IsMultiplicativeGeneralizedRowVector</code> (<a href="chap21.html#X7FBCA5B58308C158"><span class="RefLink">21.12-2</span></a>).</p>
<p>All internally represented lists are in this category, and also all lists in the representations <code class="code">IsGF2VectorRep</codejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">v:= [ 1, 2 ];; m:= [ v, 2*v ];;</span>
<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>
rue
false
</pre></div>
id="X8428E77B86722D52"name="X8428E77B86722D52"></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>
<p>For a <strong class="pkg">GAP</strong> object <var class="Arg">obj</var>, <code <span class="GAPprompt">gap></span> <span class="GAPinput">l1:= [ 1, , 3, 4 ];; ,,4,];/span>
<p><a id="X84B383B97FD986CD" name="X84B383B97FD986CD"></a></p>
<h5>21.12-5 NestingDepthM</h5>
<">‣ NestingDepthM</code>( <var class="Arg">obj</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For a <strong classjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
<class"java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 26
<span class="GAPprompt">gap></span> <span class="GAPinput">NestingDepthA( v ); 2
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="APprompt">gap&<span span class""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[ 1, 2 ,[3,4], [ 10,12 ]]
<div class="example"><<p>For two <strong classpkg></strong> objects <span class="SimpleMath">x</span> and <span class="SimpleMath>y</span> ofwhich is <code class"func><code < ".java.lang.StringIndexOutOfBoundsException: Index 564 out of bounds for length 564
<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="X7B91CE4D814C2D08" name="X7B91CE4D814C2D08"></a></p>
<h5>21.13-2 <span class="Heading">AdditiveInverse for lists</span></h5>
> inversesee<class""/>< =java.lang.StringIndexOutOfBoundsException: Index 532 out of bounds for length 532
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">AdditiveInverse( [ 1, 2, 3 ] ); AdditiveInverse( [ [ 1, 2 ], 3 ] );</span>
[ -1, -2, -3 ]
[ [ -1, -2 ], -3 ]
</pre></div>
<p><a id="X842D123E7EE5E3DB" name="X842D123E7EE5E3DB"></a></p>
<h5>21.13-3 <span class="Heading">Addition of lists</span></h5>
<p>If <span class="SimpleMath">x</span> and <span class="SimpleMath">y</span> are in <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>) and have the same additive nesting depth (see <code class="func">NestingDepthA</code> (<a href="chap21.html#X8428E77B86722D52"><span class="RefLink">21.12-4</span></a>)), the sum <span class="SimpleMath">x + y</span> is defined <em>pointwise</em>, in the sense that the result is a list whose entry at position <span class="SimpleMath">i</span> is <span class="SimpleMath">x[i] + y[i]</span> if these entries are bound, is a shallow copy (see <code class="func">ShallowCopy</code> (<a href="chap12.html#X846BC7107C352031"><span class="RefLink">12.7-1</span></a>)) of <span class="SimpleMath">x[i]</span> or <span class="SimpleMath">y[i]</span> if the other argument is not bound at position <span class="SimpleMath">i</span>, and is unbound if both <span class="SimpleMath">x</span> and <span class="SimpleMath">y</span> are unbound at position <span class="SimpleMath">i</span>.</p>
<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><
[ 1, 2, strongp<aid" ="<java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 62
<span class="GAPprompt">gap></span> <span class="GAPinput">l1 + l3;</span>
[[2java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<span class="GAPprompt">gap></span> <span class="GAPinput"< "">&;/<pan =GAPinputO [1 34 ];>
[ , [ 3, 6, 3, 4, 5 ], [ 5, 8, 3, 4, 5 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">l3 + l4;[[7,8] [[3, 6 ] ]]
[ [ 1, 2 ], [ 3, 4 ], [ 10, 12 ] ]
<<ivclass=""<>
]
/pre></div>
<p><a id="X7C3DC8BE78DEECDE" name="X7C3DC8BE78DEECDE"></a></p>
<h5<>aid"X7A0FD70C80B95C00" name="X7A0FD70C80B95C00"></a></p>
<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>
class">><span> <spanclass=GAPinput">l1 l2;/>
[ 1, -2, 0, 0, -5 ]
<> <span class=GAPinput> - l3;/span>
[ [ 0, -2, 3, 4 ],, [ -4, -6, 3, 4 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">l2 - l4;</span>
[ , [ -3, -2, 3, 4, 5 ], [ -5, -4, 3, 4, 5 ] ]
<span ="GAPprompt">gap><span> <span class=GAPinput> ;<span>
[ [ 1, 2 ], [ -3, -4 ], [ 0, 0 ] ]
<<classexample>pre>
[ 1,, 3< "">&;/span><spanclass"APinput>LeftQuotient( [[1 2 ], [ 3 ] ], [1 2 ] )</span>
</pre></div>
<p><a id="X782ED7F27D8C7FC1" name="X782ED7F27D8C7FC1"></a></p>
<h4>21.14 <span class="Heading">Multiplicative java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 0
<p>In this general context, we define the results of multiplicative operations only in the following situations. For unary operations (one and inverse), the unique argument must be in <code class="func">IsMultiplicativeGeneralizedRowVector</code> (<a href="chap21.html#X7FBCA5B58308C158"><span class="RefLink">21.12-2</span></a>); for binary operations (multiplication and division), at least one argument must be in <code class="func">IsMultiplicativeGeneralizedRowVector</code> (<a href="chap21.html#X7FBCA5B58308C158"><span class="RefLink">21.12-2</span></a>), and the other either not a list or also in <code class="func">IsMultiplicativeGeneralizedRowVector</code> (<a href="chap21.html#X7FBCA5B58308C158"><span class="RefLink">21.12-2</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 onejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p><a id="X79A8A5627FD42FA5" name="X79A8A5627FD42FA5"></a></p>
<5>2114- span class"eading>Onefor </span><java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
p see<codeclassfunc>/>(<a =chap31html#X8046262384895B2A"><span class="RefLink">31.10-2</span></a>)) of a dense list <var class="Arg">x</var> in <code class="func">IsMultiplicativeGeneralizedRowVector</code> (<a href="chap21.html#X7FBCA5B58308C158"><span class="RefLink">21.12-2</span></a>) such that <var class="Arg">x</var> has even multiplicative nesting depth and has the same length as each of its rows is defined as the usual identity matrix on the outer two levels, that is, an identity matrix of the same dimensions, with diagonal entries <code class="code">One( <var class="Arg">x</var>[1][1] )</code> and off-diagonal entries <code class="code">Zero( <var class="Arg">x</var>[1][1] )</code>.</p>
<div class="example"><pre>
span =""gap></span> <spanclass=GAPinput"One [[1 2 ] [ 3,4 );<span>
[ [ 1, 0 ], [ 0, 1 ] ]
<span class="GAPprompt">gap></span> <span class
[[ [1 ] [[0 ]],[[ 0]] [ ] ] ] ]
</pre></div>
<p>a id=X78C6C1E2849D303A"name=X78C6C1E2849D303A"></a></p>
<h5>21.14-2 <span class="Heading">Inversespan=gap;span =>l1); IsMutable *Immutable([1 2 ]));<span>
<p>The inverse
<div class="example"><pre>
<class">>/><span class="GAPinput">Inverse( [ [ 1, 2 ], [ 3, 4 ] ] );</span>
[ [ -2, 1 ], [ 3/2, -1/
</pre><pAn use of syntactic constructs suchas<codeclass"code">< "">obj/ * var""<codeclass">< ""listvar<code andefficient waytocreate listsneeded further frommutablelists.particular constructamutablezero oflengthspan=SimpleMath">n</span> by <code class="code">0 * [ 1 .. </code><span class""n/span>code"" <code. The canbedone < ""></code>(< href=chap21.html#X80FDB1457FF582E7"><span class="RefLink">21.15-1</span></a>).</p>
<p><a id="X84FDB95179BFE4CD" name="X84FDB95179BFE4CD"></a></p>
<h5>21.14-3 <span class="Heading">Multiplication of lists</span><
<p>There are three possible computations that might be triggered by a multiplication involving a list in <code class="func">IsMultiplicativeGeneralizedRowVector</code> (<a href="chap21.html#X7FBCA5B58308C158"><span class="RefLink">21.12-2</span></a>). Namely, <span class="SimpleMath">x * y</span> might be</p>
<dl>
<dt><strong classclass">pre>
dd<>innerproduct <span class="impleMath>[]y x]*y]+⋯x]*yn</span> summands are forwhich entry span "SimpleMath></span>or span=""></>is unbound(leavesno the java.lang.StringIndexOutOfBoundsException: Range [287, 284) out of bounds for length 305
</dd>
d>strongclass"">L)/strong>/>
<dd<returns ofthe occurrence < =Arg><var in<var =Arg>list<var> <code class="keyw>fail/>if< class"Arg><var notcontained <class=Arg"list/var.Ifastarting v ""from/var is given, the firstoccurrence search emafter<em <ar class="Arg><./p>
</>
<java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0
<dd><p>the right scalar multiple, i.e., a list whose entry at position <span class="SimpleMathjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
</dd>
</dl>
rize the situations that shall covered./>
<div class="pcenter"><table class="GAPDocTable">
<tr>
<td class="tdcenter"></td>
<td class="tdcenter/pre<div>
<td class="tdcenter">vec</td>
<td class="tdcenter">mat</td>
<tr
<tr>
<td class="tdcenter">scl</td>
<td class="<h5>21.16-2 Positio</h5>
<td class="tdcenter">(L)</td>
<td class"tdcenter">(L)</td>
</tr>
<tr>
< class"tdcenter"vec/d>
<td class=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<td class="tdcenter">(I)</td>
<td class="tdcenter">(I)</td>
</tr>
<tr>
<td class="tdcenter">mat</td>
<td class="tdcenter">(R)</td>
<td class="tdcenter">(R)</td>
< class"tdcenter"()/
</tr>
</table><br />
java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 6
<p>This means for example that the product<>aid=X7B4B10AE81602D4E name=X7B4B10AE81602D4E>/>/p
<p>Now we can state the general java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 34
<> argument in< ="">IsMultiplicativeGeneralizedRowVector/>(ahref"chap21.#X7FBCA5B58308C158"><span class="RefLink">21.12-2</span></a>) then we regard the other argument (which is then neither a list nor a domain) as a scalar, and specify result (L) or (R), depending on ordering.</p>
pIntheremaining ,both< =""x<span> < =""><>arein<code class=func>IsMultiplicativeGeneralizedRowVector/code> <chap21htmlX7FBCA5B58308C158"<span =RefLink>21122/span<a>) and distinguish possibilities by their multiplicative nesting depths. An argument with <em>odd</em> multiplicative nesting depth is regarded as a vector, and an argument with <em>even</em> multiplicative nesting depth is regarded as a scalar or a matrix.</p>
<p>So if both arguments have odd java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
<> oneargumenthas oddnesting depth the other istreated asa scalarifit has multiplicative nesting depth,and as a matrix otherwise. In the former case,wespecify result()or(R,onordering thelatter case, result Lor() dependingon ./>
<p>We are <span class=">gapgt<span>s class"">:=ightTransversalgu;;r);/>
<div class="example"><pre>
s "">gapgt<span><span "GAPinput" ) (,)1,2, (,,3),13,),(3)] 14;/>
[ (1,4),spanclass=""gapgt<span <pan ""PositionCanonical(t,,2)<>
<span class="GAPprompt">gap></span> <span class="GAPinput">[ 1, 2, , 4 ] * 2;</span>
[ 2, 4,, 8 ]
<span p><a id="X7D2B25B484591506name=X7D2B25B484591506"></a></p>
22
<span class="GAPprompt">gap></span> <span class="GAPinput">m:= [ [ 1, 2 ], 3 ];; h5.164PositionNthOccurrenceh5
[ [ 7, 8 ], [ [ 3, 6 ], 9 ] ]
=>&<span>< =GAPinput> m=m] *m m[2]* m]/>
true
<span class="GAPprompt">java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
14
=GAPprompt"gapgt;/span <spanclass"GAPinput"n *n = n[1] n1]+ n2 *n2;/spanjava.lang.StringIndexOutOfBoundsException: Index 103 out of bounds for length 103
true
< =GAPprompt&<java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 112
<p><a id="X82EA2A5B786181C7" name="X82EA2A5B786181C7"></a></p>
<>.- < class"Heading">of lists/span><>
<p>For two <strong class="pkg">GAP</strong> objects <span class=
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">[ 1, 2, 3 ] / 2; [ 1, 2 ] / [ [ 1/>/java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 12
[ 1/2, 1, 3/2 ]
[ 1, 0 ]
</pre></div>
<p<a id"X7A0FD70C80B95C00" name"X7A0FD70C80B95C00"></a></p>
<h5>21.14-5 <span class="Heading">mod for lists</span></h5>
<p>If << class""<tableclass""width=100"<>td class=tdleft"<codeclass=func>#8227; PositionSorted</code>( <var class="Arg">list</var>, <var class="Arg">elm</var>[, <var class="Arg">func</var>] )</td><td class="tdright">( function )</td></tr></table></div>
pIf spanclass=><span code "">sMultiplicativeGeneralizedRowVectorcode < =chap21.tml
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">4711 mod [ 2, 3,, 5, 7 ];</span>
[ 1, 1,, 1, 0 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">[ 2, 3, 4, 5, 6 ] mod 3;</span>
[, 0,1, , java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
<span class="GAPprompt"gapgt;/>span ""[,, 14, mod[ ,5, 7 ];</java.lang.StringIndexOutOfBoundsException: Range [104, 103) out of bounds for length 104
[ 1, 2, 0, 16 ]
</pre<div>
<p><a id="X84BB2DFB8432A1A4" name="X84BB2DFB8432A1A4"></a></p>
<h5>21.14-6 <span class="<>Developers who to this custom typesto java.lang.StringIndexOutOfBoundsException: Range [75, 74) out of bounds for length 157
<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">IsMultiplicativeGeneralizedRowVector</code> (<a href="chap21.html#X7FBCA5B58308C158"><span class="RefLink">21.12-2</span></a>) and the other is also in <code class="func">IsMultiplicativeGeneralizedRowVector</code> (<a href="chap21.html#X7FBCA5B58308C158"><span class="RefLink">21.12-2</span></a>) or is neither a list nor a domain, <code class="code">LeftQuotient( <var class="Arg">x</var>, <var class="Arg">y</var> )</code> is defined as <span class="SimpleMath">x^{-1} * y</span>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">LeftQuotient( [ [ 1, 2 ], [ 3, 4 ] ], [ 1, 2 ] );</span>
[ 0, 1/2 ]
</pre></div>
<p><a id="X8676EFE67972FD06" name="X8676EFE67972FD06"></a></p>
<h4>21.15 <span class="Heading">Mutability Status and List Arithmetic</span></h4>
<p>Many results of arithmetic operations, when applied to lists, are again lists, and it is of interest whether their entries are mutable or not (if applicable). Note that the mutability status of the result itself is already defined by the general rule for any result of an arithmetic operation, not only for lists (see <a href="chap12.html#X7F0C119682196D65"><span class="RefLink">12.6</span></a>).</p>
<p>However, we do <em>not</em> define exactly the mutability status for each element on each level of a nested list returned by an arithmetic operation. (Of course it would be possible to define this recursively, but since the methods used are in general not recursive, in particular for efficient multiplication of compressed matrices, such a general definition would be a burden in these cases.) Instead we consider, for a list <span class="SimpleMath">x</span> in <code class="func">IsGeneralizedRowVector</code> (<a href= | | |