File: chap2.html

package info (click to toggle)
gap-utils 0.93-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,504 kB
  • sloc: xml: 2,167; javascript: 155; makefile: 105
file content (104 lines) | stat: -rw-r--r-- 5,790 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?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 (Utils) - Chapter 2: Printing Lists and Iterators</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="chap2"  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="chapBib.html">Bib</a>  <a href="chapInd.html">Ind</a>  </div>

<div class="chlinkprevnexttop">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp;  <a href="chap0.html#contents">[Contents]</a>&nbsp;  &nbsp;<a href="chap1.html">[Previous Chapter]</a>&nbsp;  &nbsp;<a href="chap3.html">[Next Chapter]</a>&nbsp;  </div>

<p id="mathjaxlink" class="pcenter"><a href="chap2_mj.html">[MathJax on]</a></p>
<p><a id="X83686EE47E4D4F66" name="X83686EE47E4D4F66"></a></p>
<div class="ChapSects"><a href="chap2.html#X83686EE47E4D4F66">2 <span class="Heading">Printing Lists and Iterators</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap2.html#X7F6817927F86240F">2.1 <span class="Heading">Printing selected items</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap2.html#X784638AC84D49870">2.1-1 PrintSelection</a></span>
</div></div>
</div>

<h3>2 <span class="Heading">Printing Lists and Iterators</span></h3>

<p><a id="X7F6817927F86240F" name="X7F6817927F86240F"></a></p>

<h4>2.1 <span class="Heading">Printing selected items</span></h4>

<p>The functions described here print lists or objects with an iterator with one item per line, either the whole list/iterator or certain subsets:</p>


<ul>
<li><p>by giving a list of positions of items to be printed, or</p>

</li>
<li><p>by specifying a first item and then a regular step.</p>

</li>
</ul>
<p><a id="X784638AC84D49870" name="X784638AC84D49870"></a></p>

<h5>2.1-1 PrintSelection</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PrintSelection</code>( <var class="Arg">obj</var>, <var class="Arg">list</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PrintSelection</code>( <var class="Arg">obj</var>, <var class="Arg">first</var>, <var class="Arg">step</var>[, <var class="Arg">last</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>This function, given three (or four) parameters, calls operations <code class="code">PrintSelectionFromList</code> or <code class="code">PrintSelectionFromIterator</code> which prints the <em>first</em> item specified, and then the item at every <em>step</em>. The fourth parameter is essential when the object being printed is infinite.</p>

<p>Alternatively, given two parameters, with the second parameter a list <code class="code">L</code> of positive integers, only the items at positions in <code class="code">L</code> are printed.</p>


<div class="example"><pre>

<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">L := List( [1..20], n -&gt; n^5 );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PrintSelection( L, [18..20] );</span>
18 : 1889568
19 : 2476099
20 : 3200000
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PrintSelection( L, 2, 9 );       </span>
2 : 32
11 : 161051
20 : 3200000
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PrintSelection( L, 2, 3, 11 );</span>
2 : 32
5 : 3125
8 : 32768
11 : 161051
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">s5 := SymmetricGroup( 5 );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PrintSelection( s5, [30,31,100,101] );</span>
30 : (1,5)(3,4)
31 : (1,5,2)
100 : (1,4,3)
101 : (1,4)(3,5)
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PrintSelection( s5, 1, 30 );</span>
1 : ()
31 : (1,5,2)
61 : (1,2,3)
91 : (1,3,5,2,4)
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PrintSelection( s5, 9, 11, 43 );</span>
9 : (2,5,3)
20 : (2,4)
31 : (1,5,2)
42 : (1,5,2,3,4)

</pre></div>


<div class="chlinkprevnextbot">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp;  <a href="chap0.html#contents">[Contents]</a>&nbsp;  &nbsp;<a href="chap1.html">[Previous Chapter]</a>&nbsp;  &nbsp;<a href="chap3.html">[Next Chapter]</a>&nbsp;  </div>


<div class="chlinkbot"><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="chapBib.html">Bib</a>  <a href="chapInd.html">Ind</a>  </div>

<hr />
<p class="foot">generated by <a href="https://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
</body>
</html>