This file is indexed.

/usr/share/doc/nip2/html/nipguidese28.html is in nip2 8.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
  "http://www.w3.org/TR/html4/loose.dtd">  
<html > 
<head><title>Lists and recursion</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> 
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> 
<!-- 3,html --> 
<meta name="src" content="nipguide.tex"> 
<meta name="date" content="2015-12-30 22:44:00"> 
<link rel="stylesheet" type="text/css" href="nipguide.css"> 
</head><body 
>
  <!--l. 709--><div class="crosslinks"><p class="noindent">[<a 
href="nipguidese29.html" >next</a>] [<a 
href="nipguidese27.html" >prev</a>] [<a 
href="nipguidese27.html#tailnipguidese27.html" >prev-tail</a>] [<a 
href="#tailnipguidese28.html">tail</a>] [<a 
href="nipguidech6.html#nipguidese28.html" >up</a>] </p></div>
  <h3 class="sectionHead"><span class="titlemark">6.7    </span> <a 
 id="x39-710006.7"></a>Lists and recursion</h3>
<!--l. 710--><p class="noindent" ><a name="nip_label_sec:lists"></a>
<!--l. 712--><p class="indent" >  Functional programming languages do not have variables,
assignment or iteration. You can achieve the same effects
using just lists and recursion.
<!--l. 715--><p class="indent" >  There are two main sorts of recursion over lists. The first
is called <span 
class="ptmri7t-">mapping</span>: a function is applied to each element of a
list, producing a new list in which each element has been
transformed.
                                                 <div class="verbatim" id="verbatim-55">
  map&#x00A0;fn&#x00A0;[a,b,c]&#x00A0;==&#x00A0;[fn&#x00A0;a,&#x00A0;fn&#x00A0;b,&#x00A0;fn&#x00A0;c] 
</div>
<!--l. 721--><p class="nopar" >
<!--l. 723--><p class="indent" >  The second main sort of recursion is called <span 
class="ptmri7t-">folding</span>: a list
is turned into a single value by joining pairs of elements
together with a function and a start value.
                                                                                       

                                                                                       
  <div class="verbatim" id="verbatim-56">
foldr&#x00A0;fn&#x00A0;start&#x00A0;[a,b&#x00A0;..&#x00A0;c]&#x00A0;==
&#x00A0;<br />&#x00A0;&#x00A0;(fn&#x00A0;a&#x00A0;(fn&#x00A0;b&#x00A0;(..&#x00A0;(fn&#x00A0;c&#x00A0;start))))
</div>
<!--l. 730--><p class="nopar" >
<!--l. 732--><p class="noindent" >(The function is called <span 
class="phvr7t-x-x-80">foldr </span>as it folds the list up
right-to-left. There is an analogous function called <span 
class="phvr7t-x-x-80">foldl</span>
which folds a list up left-to-right, but because of the way
lists work, it is much slower and should be avoided if
possible.)
<!--l. 738--><p class="indent" >  <span 
class="phvr7t-x-x-80">map </span>is defined in the standard list library for you:
                                                 <div class="verbatim" id="verbatim-57">
  /&#x22C6;&#x00A0;map&#x00A0;fn&#x00A0;l:&#x00A0;map&#x00A0;function&#x00A0;fn&#x00A0;over&#x00A0;list&#x00A0;l
 &#x00A0;<br />&#x00A0;&#x22C6;/
 &#x00A0;<br />
 &#x00A0;<br />map&#x00A0;fn&#x00A0;l
 &#x00A0;<br />&#x00A0;&#x00A0;=&#x00A0;[],&#x00A0;l&#x00A0;==&#x00A0;[]
 &#x00A0;<br />&#x00A0;&#x00A0;=&#x00A0;fn&#x00A0;(hd&#x00A0;l)&#x00A0;:&#x00A0;map&#x00A0;fn&#x00A0;(tl&#x00A0;l) 
</div>
<!--l. 747--><p class="nopar" >
<!--l. 749--><p class="noindent" >So, for example, you could use <span 
class="phvr7t-x-x-80">map </span>like this:
                                                                                       

                                                                                       
  <div class="verbatim" id="verbatim-58">
map&#x00A0;(add&#x00A0;2)&#x00A0;[1..5]&#x00A0;==&#x00A0;[3,4,5,6,7,8]
</div>
<!--l. 754--><p class="nopar" >
<!--l. 756--><p class="indent" >  <span 
class="phvr7t-x-x-80">foldr </span>is defined in the standard list library for you:
                                                 <div class="verbatim" id="verbatim-59">
  /&#x22C6;&#x00A0;foldr&#x00A0;fn&#x00A0;st&#x00A0;l:&#x00A0;fold&#x00A0;up&#x00A0;list&#x00A0;l,
 &#x00A0;<br />&#x00A0;&#x22C6;&#x00A0;right&#x00A0;to&#x00A0;left&#x00A0;with&#x00A0;function&#x00A0;fn&#x00A0;and
 &#x00A0;<br />&#x00A0;&#x22C6;&#x00A0;start&#x00A0;value&#x00A0;st
 &#x00A0;<br />&#x00A0;&#x22C6;/
 &#x00A0;<br />
 &#x00A0;<br />foldr&#x00A0;fn&#x00A0;st&#x00A0;l
 &#x00A0;<br />&#x00A0;&#x00A0;=&#x00A0;st,&#x00A0;l&#x00A0;==&#x00A0;[]
 &#x00A0;<br />&#x00A0;&#x00A0;=&#x00A0;fn&#x00A0;(hd&#x00A0;l)&#x00A0;(foldr&#x00A0;fn&#x00A0;st&#x00A0;(tl&#x00A0;l)) 
</div>
<!--l. 767--><p class="nopar" >
<!--l. 769--><p class="noindent" >So, for example, you could use <span 
class="phvr7t-x-x-80">foldr </span>like this:
                                                                                       

                                                                                       
  <div class="verbatim" id="verbatim-60">
foldr&#x00A0;add&#x00A0;0&#x00A0;[1..5]&#x00A0;==&#x00A0;15
</div>
<!--l. 774--><p class="nopar" >
<!--l. 776--><p class="noindent" >(Mathematically, <span 
class="phvr7t-x-x-80">foldr </span>is the more basic operation. You can
write <span 
class="phvr7t-x-x-80">map </span>in terms of <span 
class="phvr7t-x-x-80">foldr</span>, but you can&#8217;t write <span 
class="phvr7t-x-x-80">foldr </span>in terms
of <span 
class="phvr7t-x-x-80">map</span>.)
<!--l. 781--><p class="indent" >  Unconstrained recursion over lists can be very hard to
understand, rather like <span 
class="phvr7t-x-x-80">goto </span>in an imperative language. It&#8217;s
much better to use a combination of <span 
class="phvr7t-x-x-80">map </span>and <span 
class="phvr7t-x-x-80">foldr </span>if you
possibly can.
<!--l. 785--><p class="indent" >  The toolkit <span 
class="phvr7t-x-x-80">_list </span>contains definitions of most of the
standard list-processing functions. These are listed in
Table&#x00A0;<a 
href="#x39-710013">6.3<!--tex4ht:ref: tb:list --></a>. Check the source for detailed comments.
                                           
                                                                                       

                                                                                       
<!--l. 790--><p class="indent" >  <a 
 id="x39-710013"></a><hr class="float"><div class="float" 
>
                                           
                                                                                       

                                                                                       
<div class="center" 
>
<!--l. 790--><p class="noindent" >
<div class="tabular"> <table id="TBL-5" class="tabular" 
cellspacing="0" cellpadding="0" rules="groups" 
><colgroup id="TBL-5-1g"><col 
id="TBL-5-1"></colgroup><colgroup id="TBL-5-2g"><col 
id="TBL-5-2"></colgroup><tr 
class="hline"><td><hr></td><td><hr></td></tr><tr  
 style="vertical-align:baseline;" id="TBL-5-1-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-1-1"  
class="td11">Name           </td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-1-2"  
class="td11">Description                                                                              </td>
</tr><tr 
class="hline"><td><hr></td><td><hr></td></tr><tr  
 style="vertical-align:baseline;" id="TBL-5-2-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-2-1"  
class="td11"><span 
class="phvr7t-x-x-80">all l                   </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-2-2"  
class="td11">and all the elements of list <span 
class="phvr7t-x-x-80">l </span>together                                       </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-3-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-3-1"  
class="td11"><span 
class="phvr7t-x-x-80">any l                 </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-3-2"  
class="td11">or all the elements of list <span 
class="phvr7t-x-x-80">l </span>together                                          </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-4-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-4-1"  
class="td11"><span 
class="phvr7t-x-x-80">concat l            </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-4-2"  
class="td11">join a list of lists together                                                        </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-5-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-5-1"  
class="td11"><span 
class="phvr7t-x-x-80">drop n l            </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-5-2"  
class="td11">drop the first <span 
class="phvr7t-x-x-80">n </span>elements from list <span 
class="phvr7t-x-x-80">l                                               </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-6-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-6-1"  
class="td11"><span 
class="phvr7t-x-x-80">dropwhile fn l   </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-6-2"  
class="td11">drop while <span 
class="phvr7t-x-x-80">fn </span>is true                                                                 </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-7-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-7-1"  
class="td11"><span 
class="phvr7t-x-x-80">extract n l         </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-7-2"  
class="td11">extract element <span 
class="phvr7t-x-x-80">n </span>from list <span 
class="phvr7t-x-x-80">l                                                            </span></td></tr><tr  
 style="vertical-align:baseline;" id="TBL-5-8-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-8-1"  
class="td11"><span 
class="phvr7t-x-x-80">filter fn l </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-8-2"  
class="td11">all elements of <span 
class="phvr7t-x-x-80">l </span>for which <span 
class="phvr7t-x-x-80">fn </span>holds</td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-9-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-9-1"  
class="td11"><span 
class="phvr7t-x-x-80">foldl fn st l        </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-9-2"  
class="td11">fold list <span 
class="phvr7t-x-x-80">l </span>left-to-right with <span 
class="phvr7t-x-x-80">fn </span>and <span 
class="phvr7t-x-x-80">st                                              </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-10-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-10-1"  
class="td11"><span 
class="phvr7t-x-x-80">foldl1 fn l          </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-10-2"  
class="td11">like <span 
class="phvr7t-x-x-80">foldl</span>, but use the first element of the list as the start value</td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-11-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-11-1"  
class="td11"><span 
class="phvr7t-x-x-80">foldr fn st l        </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-11-2"  
class="td11">fold list <span 
class="phvr7t-x-x-80">l </span>right-to-left with <span 
class="phvr7t-x-x-80">fn </span>and <span 
class="phvr7t-x-x-80">st                                              </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-12-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-12-1"  
class="td11"><span 
class="phvr7t-x-x-80">foldr1 fn l          </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-12-2"  
class="td11">like <span 
class="phvr7t-x-x-80">foldr</span>, but use the first element of the list as the start value</td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-13-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-13-1"  
class="td11"><span 
class="phvr7t-x-x-80">index fn l          </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-13-2"  
class="td11">search list <span 
class="phvr7t-x-x-80">l </span>for index of first element matching predicate <span 
class="phvr7t-x-x-80">fn    </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-14-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-14-1"  
class="td11"><span 
class="phvr7t-x-x-80">init l                  </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-14-2"  
class="td11">remove last element of list <span 
class="phvr7t-x-x-80">l                                                            </span></td></tr><tr  
 style="vertical-align:baseline;" id="TBL-5-15-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-15-1"  
class="td11"><span 
class="phvr7t-x-x-80">iterate f x </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-15-2"  
class="td11">repeatedly apply <span 
class="phvr7t-x-x-80">f </span>to <span 
class="phvr7t-x-x-80">x</span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-16-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-16-1"  
class="td11"><span 
class="phvr7t-x-x-80">last l                 </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-16-2"  
class="td11">return the last element of list <span 
class="phvr7t-x-x-80">l                                                        </span></td></tr><tr  
 style="vertical-align:baseline;" id="TBL-5-17-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-17-1"  
class="td11"><span 
class="phvr7t-x-x-80">len l </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-17-2"  
class="td11">find length of list <span 
class="phvr7t-x-x-80">l</span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-18-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-18-1"  
class="td11"><span 
class="phvr7t-x-x-80">limit l                </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-18-2"  
class="td11">find the first element of list <span 
class="phvr7t-x-x-80">l </span>equal to its predecessor              </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-19-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-19-1"  
class="td11"><span 
class="phvr7t-x-x-80">map fn l            </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-19-2"  
class="td11">map function <span 
class="phvr7t-x-x-80">fn </span>over list <span 
class="phvr7t-x-x-80">l                                                                </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-20-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-20-1"  
class="td11"><span 
class="phvr7t-x-x-80">map2 fn l1 l2    </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-20-2"  
class="td11">map 2-ary function <span 
class="phvr7t-x-x-80">fn </span>over lists <span 
class="phvr7t-x-x-80">l1 </span>and <span 
class="phvr7t-x-x-80">l2                                      </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-21-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-21-1"  
class="td11"><span 
class="phvr7t-x-x-80">map3 fn l1 l2 l3</span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-21-2"  
class="td11">map 3-ary function <span 
class="phvr7t-x-x-80">fn </span>over lists <span 
class="phvr7t-x-x-80">l1</span>, <span 
class="phvr7t-x-x-80">l2 </span>and <span 
class="phvr7t-x-x-80">l3                                 </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-22-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-22-1"  
class="td11"><span 
class="phvr7t-x-x-80">member l x       </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-22-2"  
class="td11">true if <span 
class="phvr7t-x-x-80">x </span>is a member of list <span 
class="phvr7t-x-x-80">l                                                           </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-23-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-23-1"  
class="td11"><span 
class="phvr7t-x-x-80">mkset l             </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-23-2"  
class="td11">remove duplicates from list <span 
class="phvr7t-x-x-80">l                                                          </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-24-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-24-1"  
class="td11"><span 
class="phvr7t-x-x-80">postfix l r          </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-24-2"  
class="td11">add element <span 
class="phvr7t-x-x-80">r </span>to the end of list <span 
class="phvr7t-x-x-80">l                                                     </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-25-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-25-1"  
class="td11"><span 
class="phvr7t-x-x-80">product l           </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-25-2"  
class="td11">product of list l                                                                        </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-26-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-26-1"  
class="td11"><span 
class="phvr7t-x-x-80">repeat x           </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-26-2"  
class="td11">make an infinite list of <span 
class="phvr7t-x-x-80">x</span>es                                                       </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-27-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-27-1"  
class="td11"><span 
class="phvr7t-x-x-80">replicate n x     </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-27-2"  
class="td11">make <span 
class="phvr7t-x-x-80">n </span>copies of <span 
class="phvr7t-x-x-80">x </span>in a list                                                       </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-28-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-28-1"  
class="td11"><span 
class="phvr7t-x-x-80">reverse l           </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-28-2"  
class="td11">reverse list <span 
class="phvr7t-x-x-80">l                                                                                        </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-29-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-29-1"  
class="td11"><span 
class="phvr7t-x-x-80">scan fn st l       </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-29-2"  
class="td11">apply <span 
class="phvr7t-x-x-80">(foldr fn r) </span>to every initial segment of list <span 
class="phvr7t-x-x-80">l                          </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-30-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-30-1"  
class="td11"><span 
class="phvr7t-x-x-80">sort l                </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-30-2"  
class="td11">sort list <span 
class="phvr7t-x-x-80">l </span>into ascending order                                                  </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-31-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-31-1"  
class="td11"><span 
class="phvr7t-x-x-80">sortc fn l           </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-31-2"  
class="td11">sort list <span 
class="phvr7t-x-x-80">l </span>into order by using a comparison function               </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-32-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-32-1"  
class="td11"><span 
class="phvr7t-x-x-80">sortpl pl l          </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-32-2"  
class="td11">sort list <span 
class="phvr7t-x-x-80">l </span>by predicate list <span 
class="phvr7t-x-x-80">pl                                                            </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-33-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-33-1"  
class="td11"><span 
class="phvr7t-x-x-80">sortr l               </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-33-2"  
class="td11">sort list <span 
class="phvr7t-x-x-80">l </span>into descending order                                                </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-34-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-34-1"  
class="td11"><span 
class="phvr7t-x-x-80">split fn l            </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-34-2"  
class="td11">break list <span 
class="phvr7t-x-x-80">l </span>into sections separated by predicate <span 
class="phvr7t-x-x-80">fn                     </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-35-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-35-1"  
class="td11"><span 
class="phvr7t-x-x-80">splits fn l          </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-35-2"  
class="td11">break list <span 
class="phvr7t-x-x-80">l </span>into single sections separated by predicate <span 
class="phvr7t-x-x-80">fn         </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-36-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-36-1"  
class="td11"><span 
class="phvr7t-x-x-80">splitpl pl l          </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-36-2"  
class="td11">break list <span 
class="phvr7t-x-x-80">l </span>up by predicate list <span 
class="phvr7t-x-x-80">pl                                                   </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-37-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-37-1"  
class="td11"><span 
class="phvr7t-x-x-80">split</span><span 
class="phvr7t-x-x-80">_lines n l    </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-37-2"  
class="td11">break list <span 
class="phvr7t-x-x-80">l </span>into lines of length <span 
class="phvr7t-x-x-80">n                                                    </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-38-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-38-1"  
class="td11"><span 
class="phvr7t-x-x-80">sum l                </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-38-2"  
class="td11">sum list l                                                                                  </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-39-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-39-1"  
class="td11"><span 
class="phvr7t-x-x-80">take n l             </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-39-2"  
class="td11">take the first <span 
class="phvr7t-x-x-80">n </span>elements from list <span 
class="phvr7t-x-x-80">l                                                </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-40-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-40-1"  
class="td11"><span 
class="phvr7t-x-x-80">takewhile fn l    </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-40-2"  
class="td11">take from the front of <span 
class="phvr7t-x-x-80">l </span>while <span 
class="phvr7t-x-x-80">fn </span>holds                                      </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-41-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-41-1"  
class="td11"><span 
class="phvr7t-x-x-80">zip2 l1 l2          </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-41-2"  
class="td11">zip two lists together                                                                </td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-5-42-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-42-1"  
class="td11"><span 
class="phvr7t-x-x-80">zip3 l1 l2 l3      </span></td><td  style="white-space:nowrap; text-align:left;" id="TBL-5-42-2"  
class="td11">zip three lists together                                                              </td>
</tr><tr 
class="hline"><td><hr></td><td><hr></td></tr><tr  
 style="vertical-align:baseline;" id="TBL-5-43-"><td  style="white-space:nowrap; text-align:left;" id="TBL-5-43-1"  
class="td11">         </td></tr></table></div></div>
<br /><div class="caption" 
><span class="id">Table&#x00A0;6.3: </span><span  
class="content">Functions in the standard list-processing toolkit</span></div><!--tex4ht:label?: x39-710013 -->
<!--l. 852--><p class="noindent" ><a name="nip_label_tb:list"></a>
                                           
                                                                                       

                                                                                       
  </div><hr class="endfloat" />
                                           
                                                                                       

                                                                                       
  <!--l. 855--><div class="crosslinks"><p class="noindent">[<a 
href="nipguidese29.html" >next</a>] [<a 
href="nipguidese27.html" >prev</a>] [<a 
href="nipguidese27.html#tailnipguidese27.html" >prev-tail</a>] [<a 
href="nipguidese28.html" >front</a>] [<a 
href="nipguidech6.html#nipguidese28.html" >up</a>] </p></div>
<!--l. 855--><p class="indent" >  <a 
 id="tailnipguidese28.html"></a>  
</body></html>