-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
2426 lines (1736 loc) · 49.3 KB
/
index.html
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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Reference</title>
<link rel="stylesheet" href="ldoc.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>ldoc</h1>
<h2>Contents</h2>
<ul>
<li><a href="#Convenience">Convenience </a></li>
<li><a href="#Coroutines">Coroutines </a></li>
<li><a href="#Functional_Essentials">Functional Essentials </a></li>
<li><a href="#Mathematical_Operators">Mathematical Operators </a></li>
<li><a href="#Operators">Operators </a></li>
<li><a href="#Ports">Ports </a></li>
<li><a href="#Predicates">Predicates </a></li>
<li><a href="#Use_With_Caution">Use With Caution </a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><strong>f.lua</strong></li>
</ul>
</div>
<div id="content">
<h1>Module <code>f.lua</code></h1>
<p>f.lua aims to be the most complete functional extension library for Lua, whilst remaining fundamentally Lua.</p>
<p>
It's fast, safe, unsurprising and fully-featured, with let statements, string lambdas, and currying. Whether you miss LISP or Haskell whilst working with Lua, this should scratch your itch, without making Lua's VM come to a screeching halt.</p>
<h2><a href="#Convenience">Convenience </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#clone">clone (o)</a></td>
<td class="summary">Clones an object & its metatable</td>
</tr>
<tr>
<td class="name" nowrap><a href="#fn">fn (s)</a></td>
<td class="summary">String Lambda!
e.g.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#guard">guard ()</a></td>
<td class="summary">A simple type-guard system
Takes a series of strings, that should be types, in the order the function being guarded would receive them.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#iter">iter (iter)</a></td>
<td class="summary">Converts an iterable into a coroutine</td>
</tr>
<tr>
<td class="name" nowrap><a href="#memoize">memoize (functor)</a></td>
<td class="summary">Return a self-caching version of a function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#timeit">timeit (functor, ...)</a></td>
<td class="summary">A benchmarking tool, it is highly not recommended to run impure functions through it.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#vend">vend (vendor)</a></td>
<td class="summary">Add a vendor path to Lua</td>
</tr>
<tr>
<td class="name" nowrap><a href="#with">with (entry, permissions, functor)</a></td>
<td class="summary">Autoclosing files and threads</td>
</tr>
</table>
<h2><a href="#Coroutines">Coroutines </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#co">co (functor)</a></td>
<td class="summary">Wrap a function in a coroutine</td>
</tr>
<tr>
<td class="name" nowrap><a href="#co.c">co.c (functor)</a></td>
<td class="summary">Create a coroutine</td>
</tr>
<tr>
<td class="name" nowrap><a href="#co.r">co.r ()</a></td>
<td class="summary">Check a coroutine is running</td>
</tr>
<tr>
<td class="name" nowrap><a href="#co.t">co.t (functor)</a></td>
<td class="summary">Toggle a coroutine's resume</td>
</tr>
</table>
<h2><a href="#Functional_Essentials">Functional Essentials </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#apply">apply (functor, args)</a></td>
<td class="summary">Apply a function recursively to a list.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#car">car (tbl)</a></td>
<td class="summary">Access the first value of an array.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#cdr">cdr (tbl)</a></td>
<td class="summary">Access the "tail" of a list</td>
</tr>
<tr>
<td class="name" nowrap><a href="#cond">cond (condlist)</a></td>
<td class="summary">A better chained else-if function.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#cons">cons (val[, tbl])</a></td>
<td class="summary">A list-creation tool</td>
</tr>
<tr>
<td class="name" nowrap><a href="#curry">curry (a, b)</a></td>
<td class="summary">A currying function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#elif">elif (predicate, a, b)</a></td>
<td class="summary">A functional else-if construct</td>
</tr>
<tr>
<td class="name" nowrap><a href="#exclude">exclude (ex_tbl, tbl)</a></td>
<td class="summary">Remove a set of values from a table</td>
</tr>
<tr>
<td class="name" nowrap><a href="#filter">filter (functor, args)</a></td>
<td class="summary">Filter a list</td>
</tr>
<tr>
<td class="name" nowrap><a href="#foldr">foldr (functor, tbl, val)</a></td>
<td class="summary">foldr</td>
</tr>
<tr>
<td class="name" nowrap><a href="#ktov">ktov (tbl)</a></td>
<td class="summary">Swap key and values in a table.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#let">let (values, functor)</a></td>
<td class="summary">A localised value binding function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#map">map (functor, args)</a></td>
<td class="summary">Create a list by recursively calling a function against a list</td>
</tr>
<tr>
<td class="name" nowrap><a href="#nth">nth (iterable, begin, fin)</a></td>
<td class="summary">Access a range from an interable</td>
</tr>
<tr>
<td class="name" nowrap><a href="#recur">recur ()</a></td>
<td class="summary">A tail-call elimination safe way of calling the calling function.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#reverse">reverse (obj)</a></td>
<td class="summary">Reverses an iterable</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set">set (tbl)</a></td>
<td class="summary">Reduce a table to a set, that is, every item must be unique.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#shuffle">shuffle (tbl)</a></td>
<td class="summary">Shuffles a given table, using Fisher-Yates, a simple swapping algo.</td>
</tr>
</table>
<h2><a href="#Mathematical_Operators">Mathematical Operators </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#add">add (a, b)</a></td>
<td class="summary">Addition operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#clamp">clamp (x, n, y)</a></td>
<td class="summary">Clamp a number between two others</td>
</tr>
<tr>
<td class="name" nowrap><a href="#div">div (a, b)</a></td>
<td class="summary">Division operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#div.int">div.int (a, b)</a></td>
<td class="summary">Integer division operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#mul">mul (a, b)</a></td>
<td class="summary">Multiplication operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#random">random ([x[, y]])</a></td>
<td class="summary">Wraps math.random, unless x is a table, in which case it gives a
random item from that table.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#random.weighted">random.weighted (tbl)</a></td>
<td class="summary">Given a weighted table, (e.g.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#round">round (num, depth)</a></td>
<td class="summary">Round a number to a certain number of places</td>
</tr>
<tr>
<td class="name" nowrap><a href="#sub">sub (a, b)</a></td>
<td class="summary">Subtraction operator</td>
</tr>
</table>
<h2><a href="#Operators">Operators </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#gt">gt (a, b)</a></td>
<td class="summary">Greater Than operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#gte">gte (a, b)</a></td>
<td class="summary">Great Than or Equal operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#lt">lt (a, b)</a></td>
<td class="summary">Less Than operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#lte">lte (a, b)</a></td>
<td class="summary">Less Than or Equal operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#mod">mod (a, b)</a></td>
<td class="summary">Mod Operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#ne">ne (a, b)</a></td>
<td class="summary">Not Equal operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pow">pow (a, b)</a></td>
<td class="summary">Powerto operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#unary">unary (a)</a></td>
<td class="summary">Unary operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#xnd">xnd (a, b)</a></td>
<td class="summary">And operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#xnt">xnt (a)</a></td>
<td class="summary">Not operator</td>
</tr>
<tr>
<td class="name" nowrap><a href="#xor">xor (a, b)</a></td>
<td class="summary">Or operator</td>
</tr>
</table>
<h2><a href="#Ports">Ports </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#port.from_string">port.from_string (str, functor)</a></td>
<td class="summary">Override io.read with a string</td>
</tr>
<tr>
<td class="name" nowrap><a href="#port.iter">port.iter (port, n, data)</a></td>
<td class="summary">An iterator that can be used in for-loops to read over a port-like object</td>
</tr>
<tr>
<td class="name" nowrap><a href="#port.make_input">port.make_input (read_func, close_func)</a></td>
<td class="summary">Create a port that can be read from</td>
</tr>
<tr>
<td class="name" nowrap><a href="#port.make_output">port.make_output (write_func, read_func, close_func)</a></td>
<td class="summary">Create a port that can read and write</td>
</tr>
<tr>
<td class="name" nowrap><a href="#port.with_input">port.with_input (port, functor)</a></td>
<td class="summary">Override io.read with port:read for a given port</td>
</tr>
<tr>
<td class="name" nowrap><a href="#port.with_output">port.with_output (port, functor)</a></td>
<td class="summary">Override print and io.write with port:write for a given port</td>
</tr>
</table>
<h2><a href="#Predicates">Predicates </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#eq">eq (a, b)</a></td>
<td class="summary">Test equivalence</td>
</tr>
<tr>
<td class="name" nowrap><a href="#inarray">inarray (tbl, v)</a></td>
<td class="summary">Check if a value occurs in a list</td>
</tr>
<tr>
<td class="name" nowrap><a href="#isboolean">isboolean (x)</a></td>
<td class="summary">Predicate to test boolean type</td>
</tr>
<tr>
<td class="name" nowrap><a href="#isfile">isfile (x)</a></td>
<td class="summary">Predicate to test file type</td>
</tr>
<tr>
<td class="name" nowrap><a href="#isfunction">isfunction (x)</a></td>
<td class="summary">Predicate to test function type</td>
</tr>
<tr>
<td class="name" nowrap><a href="#isnegative">isnegative (x)</a></td>
<td class="summary">Returns true or false, given any object, if it is a negative number</td>
</tr>
<tr>
<td class="name" nowrap><a href="#isnil">isnil (x)</a></td>
<td class="summary">Predicate to test nil type</td>
</tr>
<tr>
<td class="name" nowrap><a href="#isnumber">isnumber (x)</a></td>
<td class="summary">Predicate to test number type</td>
</tr>
<tr>
<td class="name" nowrap><a href="#ispositive">ispositive (x)</a></td>
<td class="summary">Returns true or false, given any object, if it is a positive number</td>
</tr>
<tr>
<td class="name" nowrap><a href="#isstring">isstring (x)</a></td>
<td class="summary">Predicate to test string type</td>
</tr>
<tr>
<td class="name" nowrap><a href="#istable">istable (x)</a></td>
<td class="summary">Predicate to test table type</td>
</tr>
<tr>
<td class="name" nowrap><a href="#isthread">isthread (x)</a></td>
<td class="summary">Predicate to test thread type</td>
</tr>
<tr>
<td class="name" nowrap><a href="#isuserdata">isuserdata (x)</a></td>
<td class="summary">Predicate to test userdata type</td>
</tr>
<tr>
<td class="name" nowrap><a href="#iszero">iszero (x)</a></td>
<td class="summary">Returns true or false, given any object, if it is 0</td>
</tr>
</table>
<h2><a href="#Use_With_Caution">Use With Caution </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#pollute">pollute ()</a></td>
<td class="summary">Pollute the global namespace with f.lua's functions.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#unpollute">unpollute ()</a></td>
<td class="summary">Undo pollution of the global namespace by f.pollute.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Convenience"></a>Convenience </h2>
<dl class="function">
<dt>
<a name = "clone"></a>
<strong>clone (o)</strong>
</dt>
<dd>
Clones an object & its metatable
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">o</span>
An object
</li>
</ul>
<h3>Returns:</h3>
<ol>
A copy of the object
</ol>
</dd>
<dt>
<a name = "fn"></a>
<strong>fn (s)</strong>
</dt>
<dd>
String Lambda!
e.g. f.fn("(x, y) print(x, y)")(2, 3)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">s</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
A string starting with parentheses as shown in the example.
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">function</span></span>
</ol>
</dd>
<dt>
<a name = "guard"></a>
<strong>guard ()</strong>
</dt>
<dd>
A simple type-guard system
Takes a series of strings, that should be types, in the order the function being guarded would receive them.
Then it optionally takes another string prepended with "->" for the return type.
Finally it must receive a function to guard.
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">function</span></span>
</ol>
</dd>
<dt>
<a name = "iter"></a>
<strong>iter (iter)</strong>
</dt>
<dd>
Converts an iterable into a coroutine
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">iter</span>
string or table iterable
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">thread</span></span>
</ol>
</dd>
<dt>
<a name = "memoize"></a>
<strong>memoize (functor)</strong>
</dt>
<dd>
Return a self-caching version of a function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">functor</span>
<span class="types"><span class="type">function</span></span>
The function whose return data should get cached
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">function</span></span>
Returns a function that caches data the first time it is called, and just returns that if the arguments are the same the next time around
</ol>
</dd>
<dt>
<a name = "timeit"></a>
<strong>timeit (functor, ...)</strong>
</dt>
<dd>
A benchmarking tool, it is highly not recommended to run impure functions through it.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">functor</span>
<span class="types"><span class="type">function</span></span>
The function to benchmark. It should be pure.
</li>
<li><span class="parameter">...</span>
Arguments to parse to functor
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Seconds taken on average across 100 runs.
</ol>
</dd>
<dt>
<a name = "vend"></a>
<strong>vend (vendor)</strong>
</dt>
<dd>
Add a vendor path to Lua
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">vendor</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">nil</span></span>
</ol>
</dd>
<dt>
<a name = "with"></a>
<strong>with (entry, permissions, functor)</strong>
</dt>
<dd>
Autoclosing files and threads
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">entry</span>
Filenme string or thread object
</li>
<li><span class="parameter">permissions</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
</li>
<li><span class="parameter">functor</span>
<span class="types"><span class="type">function</span></span>
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Coroutines"></a>Coroutines </h2>
<dl class="function">
<dt>
<a name = "co"></a>
<strong>co (functor)</strong>
</dt>
<dd>
Wrap a function in a coroutine
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">functor</span>
<span class="types"><span class="type">function</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">thread</span></span>
Returns coroutine.wrap(functor)
</ol>
</dd>
<dt>
<a name = "co.c"></a>
<strong>co.c (functor)</strong>
</dt>
<dd>
Create a coroutine
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">functor</span>
<span class="types"><span class="type">function</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">thread</span></span>
Returns coroutine.create(functor)
</ol>
</dd>
<dt>
<a name = "co.r"></a>
<strong>co.r ()</strong>
</dt>
<dd>
Check a coroutine is running
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">boolean</span></span>
Returns coroutine.running()
</ol>
</dd>
<dt>
<a name = "co.t"></a>
<strong>co.t (functor)</strong>
</dt>
<dd>
Toggle a coroutine's resume
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">functor</span>
<span class="types"><span class="type">thread</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
Either returns the coroutine.resume of functor, or nil if the thread is dead.
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Functional_Essentials"></a>Functional Essentials </h2>
<dl class="function">
<dt>
<a name = "apply"></a>
<strong>apply (functor, args)</strong>
</dt>
<dd>
Apply a function recursively to a list.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">functor</span>
The function to recursively call against the list
</li>
<li><span class="parameter">args</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
The list of arguments to be recursively called.
</li>
</ul>
<h3>Returns:</h3>
<ol>
Returns a single value created by the recursive call.
</ol>
</dd>
<dt>
<a name = "car"></a>
<strong>car (tbl)</strong>
</dt>
<dd>
Access the first value of an array.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">tbl</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
The list to be accessed
</li>
</ul>
<h3>Returns:</h3>
<ol>
The first element of the list.
</ol>
</dd>
<dt>
<a name = "cdr"></a>
<strong>cdr (tbl)</strong>
</dt>
<dd>
Access the "tail" of a list
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">tbl</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
The list to be accessed
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
Returns all but the first element in the list.
</ol>
</dd>
<dt>
<a name = "cond"></a>
<strong>cond (condlist)</strong>
</dt>
<dd>
A better chained else-if function.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">condlist</span>
A condlist is a table, containing other tables. The inner tables are pairs, where the key is a boolean. If it is true, then it's value is returned.
</li>
</ul>
<h3>Returns:</h3>
<ol>
Returns a value where the key is true.
</ol>
</dd>
<dt>
<a name = "cons"></a>
<strong>cons (val[, tbl])</strong>
</dt>
<dd>
A list-creation tool
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">val</span>
Any value
</li>
<li><span class="parameter">tbl</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
The list to join to. If one doesn't exist, it will be created.
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
The list that is generated.
</ol>
</dd>
<dt>
<a name = "curry"></a>
<strong>curry (a, b)</strong>
</dt>
<dd>
A currying function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">function</span></span>
</li>
<li><span class="parameter">b</span>
<span class="types"><span class="type">function</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">function</span></span>
A function that merges a around b, returning a new function. e.g. curry(print, string.format) is a kind of printf.
</ol>
</dd>
<dt>
<a name = "elif"></a>
<strong>elif (predicate, a, b)</strong>
</dt>
<dd>
A functional else-if construct
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">predicate</span>
<span class="types"><span class="type">boolean</span></span>
</li>
<li><span class="parameter">a</span>
Returned if predicate is true
</li>
<li><span class="parameter">b</span>
Returned if predicate is false
</li>
</ul>
<h3>Returns:</h3>
<ol>
Either a or b
</ol>
</dd>
<dt>
<a name = "exclude"></a>
<strong>exclude (ex_tbl, tbl)</strong>
</dt>
<dd>
Remove a set of values from a table
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">ex_tbl</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
The values to remove e.g. {1, 2, 3}
</li>
<li><span class="parameter">tbl</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
The table being processed e.g. {1, 2, 3, 4, 5}
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
The new table, e.g. {4, 5}
</ol>
</dd>
<dt>
<a name = "filter"></a>
<strong>filter (functor, args)</strong>
</dt>
<dd>
Filter a list
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">functor</span>
<span class="types"><span class="type">function</span></span>
A function that should return a boolean when given a value from the args list. If true, the value is added to the return list, if not, it gets dropped.
</li>
<li><span class="parameter">args</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
The list to filter
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
Returns the filtered list
</ol>
</dd>
<dt>
<a name = "foldr"></a>
<strong>foldr (functor, tbl, val)</strong>
</dt>
<dd>
foldr
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">functor</span>
<span class="types"><span class="type">function</span></span>
</li>
<li><span class="parameter">tbl</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
</li>
<li><span class="parameter">val</span>
The seed value
</li>
</ul>
<h3>Returns:</h3>
<ol>
The folded value
</ol>
</dd>
<dt>
<a name = "ktov"></a>