xref: /freebsd/contrib/lyaml/doc/modules/lyaml.functional.html (revision 2bc180ef045e5911cce0cea1c2a139cffd2b577a)
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
5<head>
6    <title>lyaml 6.2.8 Reference</title>
7    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
8</head>
9<body>
10
11<div id="container">
12
13<div id="product">
14	<div id="product_logo"></div>
15	<div id="product_name"><big><b></b></big></div>
16	<div id="product_description"></div>
17</div> <!-- id="product" -->
18
19
20<div id="main">
21
22
23<!-- Menu -->
24
25<div id="navigation">
26<br/>
27<h1>lyaml 6.2.8</h1>
28
29<ul>
30  <li><a href="../index.html">Index</a></li>
31</ul>
32
33<h2>Contents</h2>
34<ul>
35<li><a href="#Functions">Functions</a></li>
36<li><a href="#Tables">Tables</a></li>
37</ul>
38
39
40<h2>Modules</h2>
41<ul class="nowrap">
42  <li><a href="../modules/lyaml.html">lyaml</a></li>
43  <li><a href="../modules/lyaml.explicit.html">lyaml.explicit</a></li>
44  <li><strong>lyaml.functional</strong></li>
45  <li><a href="../modules/lyaml.implicit.html">lyaml.implicit</a></li>
46</ul>
47
48</div>
49
50<div id="content">
51
52<h1>Module <code>lyaml.functional</code></h1>
53<p>
54
55</p>
56<p>
57
58</p>
59
60
61<h2><a href="#Functions">Functions</a></h2>
62<table class="function_list">
63	<tr>
64	<td class="name" nowrap><a href="#isnull">isnull (x)</a></td>
65	<td class="summary"><code>lyaml.null</code> predicate.</td>
66	</tr>
67	<tr>
68	<td class="name" nowrap><a href="#iscallable">iscallable (x)</a></td>
69	<td class="summary">Callable predicate.</td>
70	</tr>
71	<tr>
72	<td class="name" nowrap><a href="#anyof">anyof (fns)</a></td>
73	<td class="summary">Compose a function to try each callable with supplied args.</td>
74	</tr>
75	<tr>
76	<td class="name" nowrap><a href="#id">id (...)</a></td>
77	<td class="summary">Return arguments unchanged.</td>
78	</tr>
79</table>
80<h2><a href="#Tables">Tables</a></h2>
81<table class="function_list">
82	<tr>
83	<td class="name" nowrap><a href="#NULL">NULL</a></td>
84	<td class="summary"><code>lyaml.null</code> value.</td>
85	</tr>
86</table>
87
88<br/>
89<br/>
90
91
92    <h2 class="section-header "><a name="Functions"></a>Functions</h2>
93
94    <dl class="function">
95    <dt>
96    <a name = "isnull"></a>
97    <strong>isnull (x)</strong>
98    </dt>
99    <dd>
100    <code>lyaml.null</code> predicate.
101
102
103    <h3>Parameters:</h3>
104    <ul>
105        <li><span class="parameter">x</span>
106         operand
107        </li>
108    </ul>
109
110    <h3>Returns:</h3>
111    <ol>
112
113           <span class="types"><span class="type">bool</span></span>
114        <code>true</code> if <em>x</em> is <code>lyaml.null</code>.
115    </ol>
116
117
118
119
120</dd>
121    <dt>
122    <a name = "iscallable"></a>
123    <strong>iscallable (x)</strong>
124    </dt>
125    <dd>
126    Callable predicate.
127
128
129    <h3>Parameters:</h3>
130    <ul>
131        <li><span class="parameter">x</span>
132         operand
133        </li>
134    </ul>
135
136    <h3>Returns:</h3>
137    <ol>
138
139           <span class="types"><span class="type">bool</span></span>
140        <code>true</code> if <em>x</em> is a function has a __call metamethod
141    </ol>
142
143
144
145    <h3>Usage:</h3>
146    <ul>
147        <pre class="example">r = iscallable(x) <span class="keyword">and</span> x(...)</pre>
148    </ul>
149
150</dd>
151    <dt>
152    <a name = "anyof"></a>
153    <strong>anyof (fns)</strong>
154    </dt>
155    <dd>
156    Compose a function to try each callable with supplied args.
157
158
159    <h3>Parameters:</h3>
160    <ul>
161        <li><span class="parameter">fns</span>
162            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
163         list of functions to try
164        </li>
165    </ul>
166
167    <h3>Returns:</h3>
168    <ol>
169
170           <span class="types"><span class="type">function</span></span>
171
172<p>a new function to call <em>...</em> functions, stopping</p>
173<pre><code>and returning the first non-nil result, if any
174</code></pre>
175
176    </ol>
177
178
179
180
181</dd>
182    <dt>
183    <a name = "id"></a>
184    <strong>id (...)</strong>
185    </dt>
186    <dd>
187    Return arguments unchanged.
188
189
190    <h3>Parameters:</h3>
191    <ul>
192        <li><span class="parameter">...</span>
193         arguments
194        </li>
195    </ul>
196
197    <h3>Returns:</h3>
198    <ol>
199
200        <em>...</em>
201    </ol>
202
203
204
205
206</dd>
207</dl>
208    <h2 class="section-header "><a name="Tables"></a>Tables</h2>
209
210    <dl class="function">
211    <dt>
212    <a name = "NULL"></a>
213    <strong>NULL</strong>
214    </dt>
215    <dd>
216    <code>lyaml.null</code> value.
217
218
219
220
221
222
223
224</dd>
225</dl>
226
227
228</div> <!-- id="content" -->
229</div> <!-- id="main" -->
230<div id="about">
231<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
232<i style="float:right;">Last updated 2022-10-22 17:12:03 </i>
233</div> <!-- id="about" -->
234</div> <!-- id="container" -->
235</body>
236</html>
237