1use crate::doc::*;
10use crate::getopts_doc::*;
11use crate::mod_node::*;
12#[cfg(feature = "plot")]
13use crate::plot_doc::*;
14
15pub fn add_std_builtin_fun_doc(sig_root_mod: &mut ModNode<Sig, ()>, doc_root_mod: &mut ModNode<String, Option<String>>)
18{
19 let doc = r#"
20Standard library that is a basic library for the Unlab scripting language.
21
22This library contains basic functions to operate on numbers, matrices, arrays, structures, and
23other objects. Also, this library allows access to system operations by providing system
24functions. Functions to running scripts, loading libraries, and testing also are provided by this
25library.
26
27# Values and objects
28
29Value types are:
30
31- none
32- boolean
33- integer number
34- floating-point number
35- reference to immutable object
36- strong reference to mutable object
37- weak reference to mutable object
38
39Immutable object types are:
40
41- string
42- integer range
43- floating-point range
44- matrix
45- function
46- matrix array
47- matrix row slice
48- error
49- window identifier
50
51Mutable object types are:
52
53- array
54- structure
55
56Indexable object types are:
57
58- string
59- matrix array
60- matrix row slice
61- array
62- structure
63
64Iterable object types are:
65
66- string
67- integer range
68- floating-point range
69- matrix array
70- matrix row slice
71- array
72
73# Mathematical functions
74
75A mathematical function with one argument recursivaly performs an operation on floating-point
76number and/or matrices. One element or one field is ignored if it isn't floating-point number,
77matrix, or mutable object and one argument is a mutable object.
78
79A mathematical function with two arguments recursively performs an operation on floating-point
80number and/or matrices. Two elements or two fields are compares with types if they aren't
81floating-point numbers, matrices, or mutable object and two arguments are mutable objects. If two
82elements or two fields aren't equal, an error occurs. One element or one field is ignored if it
83isn't a floating-point number, a matrix, or a mutable object; one argument is a mutable object;
84and other argument is a number.
85
86# TOML format and JSON format
87
88This library contains the following functions to loading values and saving values for the
89[TOML](https://en.wikipedia.org/wiki/TOML) format and the
90[JSON](https://en.wikipedia.org/wiki/JSON) format:
91
92- [`loadtoml`](#var.loadtoml)
93- [`savetoml`](#var.savetoml)
94- [`loadjson`](#var.loadjson)
95- [`savejson`](#var.savejson)
96
97These functions load and/or save the following values:
98
99- none
100- boolean
101- integer number
102- floating-point number
103- string
104- array
105- structure
106"#;
107 match doc_root_mod.value() {
108 Some(prev_doc) => doc_root_mod.set_value(Some(prev_doc.clone() + "\n" + &doc[1..])),
109 None => doc_root_mod.set_value(Some(String::from(&doc[1..]))),
110 }
111
112 let doc = r#"
113A $\pi$ number.
114"#;
115 sig_root_mod.add_var(String::from("pi"), Sig::Var);
116 doc_root_mod.add_var(String::from("pi"), String::from(&doc[1..]));
117
118 let doc = r#"
119An $e$ number.
120"#;
121 sig_root_mod.add_var(String::from("e"), Sig::Var);
122 doc_root_mod.add_var(String::from("e"), String::from(&doc[1..]));
123
124 let doc = r#"
125A machine epsilon number.
126"#;
127 sig_root_mod.add_var(String::from("eps"), Sig::Var);
128 doc_root_mod.add_var(String::from("eps"), String::from(&doc[1..]));
129
130 let doc = r#"
131A path separator that can be `"/"` for Unix or `"\\"` for Windows.
132"#;
133 sig_root_mod.add_var(String::from("pathsep"), Sig::Var);
134 doc_root_mod.add_var(String::from("pathsep"), String::from(&doc[1..]));
135
136 let doc = r#"
137Returns a string corresponding to the type of the `X` value.
138
139The stings corresponding to the value types and the object types are:
140
141- `"none"` - none value
142- `"bool"` - boolean value
143- `"int"` - integer number
144- `"float"` - floating-point number
145- `"string"` - string
146- `"intrange"` - integer range
147- `"floatrange"` - floating-point range
148- `"matrix"` - matrix
149- `"function"` - function
150- `"matrixarray"` matrix array
151- `"matrixrowslice"` - matrix row slice
152- `"error"` - error
153- `"windowid"` - window identifier
154- `"array"` - array
155- `"struct"` - structure
156- `"weak"` - weak reference
157"#;
158 sig_root_mod.add_var(String::from("type"), Sig::BuiltinFun(vec![
159 BuiltinFunArg::Arg(String::from("X"))
160 ]));
161 doc_root_mod.add_var(String::from("type"), String::from(&doc[1..]));
162
163 let doc = r#"
164Returns a copy of the `X` object.
165
166If the `X` object isn't a mutable object, this function returns the `X` object.
167"#;
168 sig_root_mod.add_var(String::from("bool"), Sig::BuiltinFun(vec![
169 BuiltinFunArg::Arg(String::from("X"))
170 ]));
171 doc_root_mod.add_var(String::from("bool"), String::from(&doc[1..]));
172
173
174 let doc = r#"
175Converts the `X` value to a boolean value.
176
177This function returns `true` if the `X` value isn't `none`, `false`, zero, or an error; otherwise
178`false`.
179"#;
180 sig_root_mod.add_var(String::from("bool"), Sig::BuiltinFun(vec![
181 BuiltinFunArg::Arg(String::from("X"))
182 ]));
183 doc_root_mod.add_var(String::from("bool"), String::from(&doc[1..]));
184
185 let doc = r#"
186Converts the `X` value to an integer number.
187
188The `X` number is converted to an integer number by this function. This function returns `1` for a
189non-numeric value if the `X` value isn't `none`, `false`, or an error; otherwise `0`.
190"#;
191 sig_root_mod.add_var(String::from("int"), Sig::BuiltinFun(vec![
192 BuiltinFunArg::Arg(String::from("X"))
193 ]));
194 doc_root_mod.add_var(String::from("int"), String::from(&doc[1..]));
195
196 let doc = r#"
197Converts the `X` value to a float-point number.
198
199The `X` number is converted to a float-point number by this function. This function returns `1.0`
200for a non-numeric value if the `X` value isn't `none`, `false`, or an error; otherwise `0.0`.
201"#;
202 sig_root_mod.add_var(String::from("float"), Sig::BuiltinFun(vec![
203 BuiltinFunArg::Arg(String::from("X"))
204 ]));
205 doc_root_mod.add_var(String::from("float"), String::from(&doc[1..]));
206
207 let doc = r#"
208Converts the `X` value to a string.
209"#;
210 sig_root_mod.add_var(String::from("string"), Sig::BuiltinFun(vec![
211 BuiltinFunArg::Arg(String::from("X"))
212 ]));
213 doc_root_mod.add_var(String::from("string"), String::from(&doc[1..]));
214 let doc = r#"
215Returns a matrix with zeros that has the `N` number of rows and the `M` number of columns.
216
217The returned matrix is:
218
219$$ \begin{bmatrix} 0 & 0 & \ldots & 0 \\ 0 & 0 & \ldots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \ldots & 0 \end{bmatrix} $$
220"#;
221 sig_root_mod.add_var(String::from("zeros"), Sig::BuiltinFun(vec![
222 BuiltinFunArg::Arg(String::from("N")),
223 BuiltinFunArg::Arg(String::from("M"))
224 ]));
225 doc_root_mod.add_var(String::from("zeros"), String::from(&doc[1..]));
226
227 let doc = r#"
228Returns a matrix with ones that has the `N` number of rows and the `M` number of columns.
229
230The returned matrix is:
231
232$$ \begin{bmatrix} 1 & 1 & \ldots & 1 \\ 1 & 1 & \ldots & 1 \\ \vdots & \vdots & \ddots & \vdots \\ 1 & 1 & \ldots & 1 \end{bmatrix} $$
233"#;
234 sig_root_mod.add_var(String::from("ones"), Sig::BuiltinFun(vec![
235 BuiltinFunArg::Arg(String::from("N")),
236 BuiltinFunArg::Arg(String::from("M"))
237 ]));
238 doc_root_mod.add_var(String::from("ones"), String::from(&doc[1..]));
239
240 let doc = r#"
241Returns an identity matrix that has the `N` number of rows and columns.
242
243The identity matrix is:
244
245$$ \begin{bmatrix} 1 & 0 & \ldots & 0 \\ 0 & 1 & \ldots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \ldots & 1 \end{bmatrix} $$
246"#;
247 sig_root_mod.add_var(String::from("eye"), Sig::BuiltinFun(vec![
248 BuiltinFunArg::Arg(String::from("N"))
249 ]));
250 doc_root_mod.add_var(String::from("eye"), String::from(&doc[1..]));
251 let doc = r#"
252Returns an initialized matrix that has the `N` number of rows and the `M` number of columns.
253
254This function applies the `f` function to the `D` value and the element indices
255($f(\mathbf{D}, i, j)$) for each element of initialized matrix. The initialized matrix is:
256
257$$ \begin{bmatrix} f(\mathbf{D}, 1, 1) & f(\mathbf{D}, 1, 2) & \ldots & f(\mathbf{D}, 1, M) \\ f(\mathbf{D}, 2, 1) & f(\mathbf{D}, 2, 2) & \ldots & f(\mathbf{D}, 2, M) \\ \vdots & \vdots & \ddots & \vdots \\ f(\mathbf{D}, N, 1) & f(\mathbf{D}, N, 2) & \ldots & f(\mathbf{D}, N, M) \end{bmatrix} $$
258"#;
259 sig_root_mod.add_var(String::from("init"), Sig::BuiltinFun(vec![
260 BuiltinFunArg::Arg(String::from("N")),
261 BuiltinFunArg::Arg(String::from("M")),
262 BuiltinFunArg::Arg(String::from("D")),
263 BuiltinFunArg::Arg(String::from("f"))
264 ]));
265 doc_root_mod.add_var(String::from("init"), String::from(&doc[1..]));
266
267 let doc = r#"
268Returns an initialized diagonal matrix that has the `N` number of rows and columns.
269
270This function applies the `f` function to the `D` value and the element index
271($f(\mathbf{D}, i)$) for each element of main diagonal of initialized diagonal matrix. The
272initialized diagonal matrix is:
273
274$$ \begin{bmatrix} f(\mathbf{D}, 1) & 0 & \ldots & 0 \\ 0 & f(\mathbf{D}, 2) & \ldots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \ldots & f(\mathbf{D}, N) \end{bmatrix} $$
275"#;
276 sig_root_mod.add_var(String::from("initdiag"), Sig::BuiltinFun(vec![
277 BuiltinFunArg::Arg(String::from("N")),
278 BuiltinFunArg::Arg(String::from("D")),
279 BuiltinFunArg::Arg(String::from("f"))
280 ]));
281 doc_root_mod.add_var(String::from("initdiag"), String::from(&doc[1..]));
282
283 let doc = r#"
284Creates a matrix from the `X` iterable object that contains the iterable objects which contains
285the numbers.
286
287If the `X` object is a matrix, this function returns the `X` object. The created matrix is:
288
289$$ \begin{bmatrix} x_{1 1} & x_{1 2} & \ldots & x_{1M} \\ x_{2 1} & x_{2 2} & \ldots & x_{2M} \\ \vdots & \vdots & \ddots & \vdots \\ x_{N1} & x_{N2} & \ldots & x_{NM} \end{bmatrix} $$
290
291"#;
292 sig_root_mod.add_var(String::from("matrix"), Sig::BuiltinFun(vec![
293 BuiltinFunArg::Arg(String::from("X"))
294 ]));
295 doc_root_mod.add_var(String::from("matrix"), String::from(&doc[1..]));
296
297 let doc = r#"
298Creates a matrix with one row from the `x` iterable object that contains the numbers.
299
300If the `x` object is a matrix with one row, this function returns the `x` object. The created matrix
301with one row is:
302
303$$ \begin{bmatrix} x_1 & x_2 & \ldots & x_N \end{bmatrix} $$
304"#;
305 sig_root_mod.add_var(String::from("rowvector"), Sig::BuiltinFun(vec![
306 BuiltinFunArg::Arg(String::from("x"))
307 ]));
308 doc_root_mod.add_var(String::from("rowvector"), String::from(&doc[1..]));
309
310 let doc = r#"
311Creates a matrix with one column vector from the `x` iterable object that contains the numbers.
312
313If the `x` object is a matrix with one column, this function returns the `x` object. The created
314matrix with one column is:
315
316$$ \begin{bmatrix} x_1 \\ x_2 \\ \vdots \\ x_N \end{bmatrix} $$
317"#;
318 sig_root_mod.add_var(String::from("colvector"), Sig::BuiltinFun(vec![
319 BuiltinFunArg::Arg(String::from("x"))
320 ]));
321 doc_root_mod.add_var(String::from("colvector"), String::from(&doc[1..]));
322
323 let doc = r#"
324Converts the `X` matrix to a matrix array.
325
326If the `X` object is a matrix array, this function returns the `X` object.
327"#;
328 sig_root_mod.add_var(String::from("matrixarray"), Sig::BuiltinFun(vec![
329 BuiltinFunArg::Arg(String::from("X"))
330 ]));
331 doc_root_mod.add_var(String::from("matrixarray"), String::from(&doc[1..]));
332
333 let doc = r#"
334Creates an error with the `kind` error kind and the `msg` message which are strings.
335"#;
336 sig_root_mod.add_var(String::from("error"), Sig::BuiltinFun(vec![
337 BuiltinFunArg::Arg(String::from("kind")),
338 BuiltinFunArg::Arg(String::from("msg"))
339 ]));
340 doc_root_mod.add_var(String::from("error"), String::from(&doc[1..]));
341
342 let doc = r#"
343Creates an array from the `X` iterable object.
344
345If the `X` value is an array, this function returns the `X` value.
346"#;
347 sig_root_mod.add_var(String::from("array"), Sig::BuiltinFun(vec![
348 BuiltinFunArg::Arg(String::from("X"))
349 ]));
350 doc_root_mod.add_var(String::from("array"), String::from(&doc[1..]));
351
352 let doc = r#"
353Converts the `R` reference to the strong reference.
354
355If the `R` reference is strong, this function returns the `R` reference.
356"#;
357 sig_root_mod.add_var(String::from("strong"), Sig::BuiltinFun(vec![
358 BuiltinFunArg::Arg(String::from("R"))
359 ]));
360 doc_root_mod.add_var(String::from("strong"), String::from(&doc[1..]));
361
362 let doc = r#"
363Converts the `R` reference to the weak reference.
364
365If the `R` reference is weak, this function returns the `R` reference.
366"#;
367 sig_root_mod.add_var(String::from("weak"), Sig::BuiltinFun(vec![
368 BuiltinFunArg::Arg(String::from("R"))
369 ]));
370 doc_root_mod.add_var(String::from("weak"), String::from(&doc[1..]));
371
372 let doc = r#"
373Returns `true` if the `X` object is empty, otherwise `false`.
374
375The `X` object can be a string, a matrix array, a matrix row slice, or an array.
376"#;
377 sig_root_mod.add_var(String::from("isempty"), Sig::BuiltinFun(vec![
378 BuiltinFunArg::Arg(String::from("X"))
379 ]));
380 doc_root_mod.add_var(String::from("isempty"), String::from(&doc[1..]));
381
382 let doc = r#"
383Returns the number of elements in the`X` object.
384
385The `X` object can be a string, a matrix array, a matrix row slice, or an array. This function
386returns the number of UTF-8 characters for a string, the number of rows for a matrix array, or the
387number of columns for a matrix row slice.
388"#;
389 sig_root_mod.add_var(String::from("length"), Sig::BuiltinFun(vec![
390 BuiltinFunArg::Arg(String::from("X"))
391 ]));
392 doc_root_mod.add_var(String::from("length"), String::from(&doc[1..]));
393
394 let doc = r#"
395Returns the number of rows in the `X` object.
396
397The `X` object can be a matrix or a matrix array.
398"#;
399 sig_root_mod.add_var(String::from("rows"), Sig::BuiltinFun(vec![
400 BuiltinFunArg::Arg(String::from("X"))
401 ]));
402 doc_root_mod.add_var(String::from("rows"), String::from(&doc[1..]));
403
404 let doc = r#"
405Returns the number of columns in the `X` object.
406
407The `X` object can be a matrix or a matrix array.
408"#;
409 sig_root_mod.add_var(String::from("columns"), Sig::BuiltinFun(vec![
410 BuiltinFunArg::Arg(String::from("X"))
411 ]));
412 doc_root_mod.add_var(String::from("columns"), String::from(&doc[1..]));
413
414 let doc = r#"
415Returns the element with one index or two indices in the `X` indexable object if the `X`
416indexable object contains the element, otherwise `none`.
417
418If the `j` index is passed and the `X` value is a matrix array, this function returns the element
419with the `i` row index and the `j` column index in the `X` matrix array. This function returns
420the string with one UTF-8 character for a string, the matrix row slice for a matrix array, or the
421element of matrix for a matrix row slice if the `j` index isn't passed. The field with the `i`
422identifier in the `X` structure is returned if the `j` index isn't passed and the `X` object is
423structure.
424"#;
425 sig_root_mod.add_var(String::from("get"), Sig::BuiltinFun(vec![
426 BuiltinFunArg::Arg(String::from("X")),
427 BuiltinFunArg::Arg(String::from("i")),
428 BuiltinFunArg::OptArg(String::from("j"))
429 ]));
430 doc_root_mod.add_var(String::from("get"), String::from(&doc[1..]));
431
432 let doc = r#"
433Returns the element with the `i` index in the diagonal of the `X` matrix array if the diagonal of
434`X` matrix array contains the element, otherwise `none`.
435"#;
436 sig_root_mod.add_var(String::from("getdiag"), Sig::BuiltinFun(vec![
437 BuiltinFunArg::Arg(String::from("X")),
438 BuiltinFunArg::Arg(String::from("i"))
439 ]));
440 doc_root_mod.add_var(String::from("getdiag"), String::from(&doc[1..]));
441
442 let doc = r#"
443Returns the substrings of the `s` string which are separated by the `t` string.
444
445If the `t` string isn't passed, this function uses whitespaces as a separator.
446"#;
447 sig_root_mod.add_var(String::from("split"), Sig::BuiltinFun(vec![
448 BuiltinFunArg::Arg(String::from("s")),
449 BuiltinFunArg::OptArg(String::from("t"))
450 ]));
451 doc_root_mod.add_var(String::from("split"), String::from(&doc[1..]));
452
453 let doc = r#"
454Returns the `s` string without the start whitespaces and the end whitespaces.
455"#;
456 sig_root_mod.add_var(String::from("trim"), Sig::BuiltinFun(vec![
457 BuiltinFunArg::Arg(String::from("s"))
458 ]));
459 doc_root_mod.add_var(String::from("trim"), String::from(&doc[1..]));
460
461 let doc = r#"
462Returns the `s` string without the start whitespaces and the end whitespaces.
463"#;
464 sig_root_mod.add_var(String::from("trim"), Sig::BuiltinFun(vec![
465 BuiltinFunArg::Arg(String::from("s"))
466 ]));
467 doc_root_mod.add_var(String::from("trim"), String::from(&doc[1..]));
468
469 let doc = r#"
470Returns the `true` if the `s` string contains the `t`, otherwise `false`.
471"#;
472 sig_root_mod.add_var(String::from("contains"), Sig::BuiltinFun(vec![
473 BuiltinFunArg::Arg(String::from("s")),
474 BuiltinFunArg::Arg(String::from("t"))
475 ]));
476 doc_root_mod.add_var(String::from("contains"), String::from(&doc[1..]));
477
478 let doc = r#"
479Returns the `true` if the `t` is the prefix of the `s` string, otherwise `false`.
480"#;
481 sig_root_mod.add_var(String::from("startswith"), Sig::BuiltinFun(vec![
482 BuiltinFunArg::Arg(String::from("s")),
483 BuiltinFunArg::Arg(String::from("t"))
484 ]));
485 doc_root_mod.add_var(String::from("startswith"), String::from(&doc[1..]));
486
487 let doc = r#"
488Returns the `true` if the `t` is the suffix of the `s` string, otherwise `false`.
489"#;
490 sig_root_mod.add_var(String::from("endswith"), Sig::BuiltinFun(vec![
491 BuiltinFunArg::Arg(String::from("s")),
492 BuiltinFunArg::Arg(String::from("t"))
493 ]));
494 doc_root_mod.add_var(String::from("endswith"), String::from(&doc[1..]));
495
496 let doc = r#"
497Replaces all occurrences of the `t` string in the `s` string with the `u` string.
498
499This function returns a new string with replaced occurrences of the `t` string to the `u` string.
500"#;
501 sig_root_mod.add_var(String::from("replace"), Sig::BuiltinFun(vec![
502 BuiltinFunArg::Arg(String::from("s")),
503 BuiltinFunArg::Arg(String::from("t")),
504 BuiltinFunArg::Arg(String::from("u"))
505 ]));
506 doc_root_mod.add_var(String::from("replace"), String::from(&doc[1..]));
507
508 let doc = r#"
509Returns an uppercase string corresponding the `s` string.
510"#;
511 sig_root_mod.add_var(String::from("upper"), Sig::BuiltinFun(vec![
512 BuiltinFunArg::Arg(String::from("s"))
513 ]));
514 doc_root_mod.add_var(String::from("upper"), String::from(&doc[1..]));
515
516 let doc = r#"
517Returns a lowercase string corresponding the `s` string.
518"#;
519 sig_root_mod.add_var(String::from("lower"), Sig::BuiltinFun(vec![
520 BuiltinFunArg::Arg(String::from("s"))
521 ]));
522 doc_root_mod.add_var(String::from("lower"), String::from(&doc[1..]));
523
524 let doc = r#"
525Sorts boolean values, numbers, or strings in the `x` array.
526
527This function uses ascending sort order to sorting. Each element in the `x` array must have same
528sorting value type that can be the boolean type, the number type, or the string type. If two or
529more elements in the `x` array have the different sorting value types, an error occurs. The
530integer numbers and the the floating-point numbers have same sorting value type. An error occurs
531if any element in the `x` array is `nan`.
532"#;
533 sig_root_mod.add_var(String::from("sort"), Sig::BuiltinFun(vec![
534 BuiltinFunArg::Arg(String::from("x"))
535 ]));
536 doc_root_mod.add_var(String::from("sort"), String::from(&doc[1..]));
537
538 let doc = r#"
539Reverses the order of elements in the `x` array.
540"#;
541 sig_root_mod.add_var(String::from("reverse"), Sig::BuiltinFun(vec![
542 BuiltinFunArg::Arg(String::from("x"))
543 ]));
544 doc_root_mod.add_var(String::from("reverse"), String::from(&doc[1..]));
545
546 let doc = r#"
547Returns `true` if the `f` function with the passed `D` value returns a convertible value to `true`
548for any element in the `X` iterable object ($f(\mathbf{D}, {\mathbf{x}}_i)$), otherwise `false`.
549"#;
550 sig_root_mod.add_var(String::from("any"), Sig::BuiltinFun(vec![
551 BuiltinFunArg::Arg(String::from("X")),
552 BuiltinFunArg::Arg(String::from("D")),
553 BuiltinFunArg::Arg(String::from("f"))
554 ]));
555 doc_root_mod.add_var(String::from("any"), String::from(&doc[1..]));
556
557 let doc = r#"
558Returns `true` if the `f` function with the passed `D` value returns a convertible value to `true`
559for all elements in the `X` iterable object ($f(\mathbf{D}, {\mathbf{x}}_i)$), otherwise
560`false`.
561"#;
562 sig_root_mod.add_var(String::from("all"), Sig::BuiltinFun(vec![
563 BuiltinFunArg::Arg(String::from("X")),
564 BuiltinFunArg::Arg(String::from("D")),
565 BuiltinFunArg::Arg(String::from("f"))
566 ]));
567 doc_root_mod.add_var(String::from("all"), String::from(&doc[1..]));
568
569 let doc = r#"
570Finds the element in the `X` iterable object.
571
572This function applies the `f` function to the `D` value and each element in the `X` iterable
573object ($f(\mathbf{D}, {\mathbf{x}}_i)$) until the `f` function returns a convertible value to
574`true` and then returns the index of this element. If the `f` function doesn't return the
575convertible value to `true` for any element, this function returns `none`.
576"#;
577 sig_root_mod.add_var(String::from("find"), Sig::BuiltinFun(vec![
578 BuiltinFunArg::Arg(String::from("X")),
579 BuiltinFunArg::Arg(String::from("D")),
580 BuiltinFunArg::Arg(String::from("f"))
581 ]));
582 doc_root_mod.add_var(String::from("find"), String::from(&doc[1..]));
583
584 let doc = r#"
585Filters the elements in the `X` iterable object.
586
587This function applies the `f` function to the `D` value and each element in the `X` iterable
588object ($f(\mathbf{D}, {\mathbf{x}}_i)$) and then returns the indices of elements for which the
589`f` function returns a convertible value to `true`.
590"#;
591 sig_root_mod.add_var(String::from("filter"), Sig::BuiltinFun(vec![
592 BuiltinFunArg::Arg(String::from("X")),
593 BuiltinFunArg::Arg(String::from("D")),
594 BuiltinFunArg::Arg(String::from("f"))
595 ]));
596 doc_root_mod.add_var(String::from("filter"), String::from(&doc[1..]));
597
598 let doc = r#"
599Finds maximum element in the `X` iterable object or maximum value between the `X` value and the
600`Y` value ($\max(x, y)$, $\max(x_{ij}, y)$, $\max(x, y_{ij})$, or $\max(x_{ij}, y_{ij})$).
601
602This function with two arguments is a mathematical function that takes two arguments. This
603argument can be a number, a matrix, or a mutable object. These arguments can't be a matrix and a
604mutable object. If the `X` value and the `Y` value are integer numbers, this function also
605returns an integer number. This function returns `none` if the `X` iterable object is empty and
606the `Y` value isn't passed.
607"#;
608 sig_root_mod.add_var(String::from("max"), Sig::BuiltinFun(vec![
609 BuiltinFunArg::Arg(String::from("X")),
610 BuiltinFunArg::OptArg(String::from("Y"))
611 ]));
612 doc_root_mod.add_var(String::from("max"), String::from(&doc[1..]));
613
614 let doc = r#"
615Finds minimum element in the `X` iterable object or minimum value between the `X` value and the
616`Y` value ($\min(x, y)$, $\min(x_{ij}, y)$, $\min(x, y_{ij})$, or $\min(x_{ij}, y_{ij})$).
617
618This function with two arguments is a mathematical function that takes two arguments. This
619argument can be a number, a matrix, or a mutable object. These arguments can't be a matrix and a
620mutable object. If the `X` value and the `Y` value are integer numbers, this function also
621returns an integer number. This function returns `none` if the `X` iterable object is empty and
622the `Y` value isn't passed.
623"#;
624 sig_root_mod.add_var(String::from("min"), Sig::BuiltinFun(vec![
625 BuiltinFunArg::Arg(String::from("X")),
626 BuiltinFunArg::OptArg(String::from("Y"))
627 ]));
628 doc_root_mod.add_var(String::from("min"), String::from(&doc[1..]));
629
630 let doc = r#"
631Finds maximum element in the `X` iterable object and returns its index.
632
633This function returns `none` if the `X` iterable object is empty.
634"#;
635 sig_root_mod.add_var(String::from("imax"), Sig::BuiltinFun(vec![
636 BuiltinFunArg::Arg(String::from("X"))
637 ]));
638 doc_root_mod.add_var(String::from("imax"), String::from(&doc[1..]));
639
640 let doc = r#"
641Finds minumum element in the `X` iterable object and returns its index.
642
643This function returns `none` if the `X` iterable object is empty.
644"#;
645 sig_root_mod.add_var(String::from("imin"), Sig::BuiltinFun(vec![
646 BuiltinFunArg::Arg(String::from("X"))
647 ]));
648 doc_root_mod.add_var(String::from("imin"), String::from(&doc[1..]));
649
650 let doc = r#"
651Pushes the `y` value to the back of the`X` array.
652"#;
653 sig_root_mod.add_var(String::from("push"), Sig::BuiltinFun(vec![
654 BuiltinFunArg::Arg(String::from("X")),
655 BuiltinFunArg::Arg(String::from("y"))
656 ]));
657 doc_root_mod.add_var(String::from("push"), String::from(&doc[1..]));
658
659 let doc = r#"
660Removes the last element from the `X` array and returns the last element.
661
662If the `X` array is empty, this function returns `none`.
663"#;
664 sig_root_mod.add_var(String::from("pop"), Sig::BuiltinFun(vec![
665 BuiltinFunArg::Arg(String::from("X"))
666 ]));
667 doc_root_mod.add_var(String::from("pop"), String::from(&doc[1..]));
668
669 let doc = r#"
670Appends the `Y` mutable object to the `X` mutable object.
671
672The `X` mutable object and the `Y` mutable object must be arrays or structures. If two fields in
673two structures have same field identifier, the field in the first structure is overwritten by a
674value from the field in the second structure.
675"#;
676 sig_root_mod.add_var(String::from("append"), Sig::BuiltinFun(vec![
677 BuiltinFunArg::Arg(String::from("X")),
678 BuiltinFunArg::Arg(String::from("Y"))
679 ]));
680 doc_root_mod.add_var(String::from("append"), String::from(&doc[1..]));
681
682 let doc = r#"
683Inserts the `y` value to the `X` mutable object.
684
685If the `X` mutable object is an array, this function inserts the `y` value as an element with the
686`i` index to the `X` array, moves all elements after the inserted element to right, and returns
687`none`. If the `X` mutable object is a structure, this function inserts the `X` value as a field
688with the `i` identifier to the `X` structure and then returns the replaced field. This function
689returns `none` if the `X` structure doesn't contain the field with the `i` identifier.
690"#;
691 sig_root_mod.add_var(String::from("insert"), Sig::BuiltinFun(vec![
692 BuiltinFunArg::Arg(String::from("X")),
693 BuiltinFunArg::Arg(String::from("i")),
694 BuiltinFunArg::Arg(String::from("y"))
695 ]));
696 doc_root_mod.add_var(String::from("insert"), String::from(&doc[1..]));
697
698 let doc = r#"
699Removes the element from the `X` mutable object.
700
701If the `X` mutable object is an array, this function removes an element with the `i` index from
702the `X` array and moves all elements after the removed element to left. If the `X` mutable object
703is a structure, this function removes a field with the `i` identifier from the `X` structure.
704This finction returns the removed element or the removed field if the `X` mutable object contains
705the element with the `i` index or the field with the `i` identifier, otherwise `none`.
706"#;
707 sig_root_mod.add_var(String::from("remove"), Sig::BuiltinFun(vec![
708 BuiltinFunArg::Arg(String::from("X")),
709 BuiltinFunArg::Arg(String::from("i"))
710 ]));
711 doc_root_mod.add_var(String::from("remove"), String::from(&doc[1..]));
712
713 let doc = r#"
714Returns the error kind for the `e` error.
715"#;
716 sig_root_mod.add_var(String::from("errorkind"), Sig::BuiltinFun(vec![
717 BuiltinFunArg::Arg(String::from("e"))
718 ]));
719 doc_root_mod.add_var(String::from("errorkind"), String::from(&doc[1..]));
720
721 let doc = r#"
722Returns the error message for the `e` error.
723"#;
724 sig_root_mod.add_var(String::from("errormsg"), Sig::BuiltinFun(vec![
725 BuiltinFunArg::Arg(String::from("e"))
726 ]));
727 doc_root_mod.add_var(String::from("errormsg"), String::from(&doc[1..]));
728
729 let doc = r#"
730Returns `true` if the `X` value is equal to the `Y` value, otherwise `false`.
731
732This function doesn't compare matrices. The result of this function is `false` if two values are
733matrices. This function doesn't compare value types for integer numbers and floating-point
734numbers.
735"#;
736 sig_root_mod.add_var(String::from("isequal"), Sig::BuiltinFun(vec![
737 BuiltinFunArg::Arg(String::from("X")),
738 BuiltinFunArg::Arg(String::from("Y"))
739 ]));
740 doc_root_mod.add_var(String::from("isequal"), String::from(&doc[1..]));
741
742 let doc = r#"
743Returns `true` if the `X` value isn't equal to the `Y` value, otherwise `false`.
744
745This function doesn't compare matrices. The result of this function is `true` if two values are
746matrices. This function doesn't compare value types for integer numbers and floating-point
747numbers.
748"#;
749 sig_root_mod.add_var(String::from("isnotequal"), Sig::BuiltinFun(vec![
750 BuiltinFunArg::Arg(String::from("X")),
751 BuiltinFunArg::Arg(String::from("Y"))
752 ]));
753 doc_root_mod.add_var(String::from("isnotequal"), String::from(&doc[1..]));
754
755 let doc = r#"
756Returns `true` if the `X` value is less than the `Y` value, otherwise `false`.
757
758This function compares two boolean values, two numbers, or two strings. The result of this
759function is `false` for two other values.
760"#;
761 sig_root_mod.add_var(String::from("isless"), Sig::BuiltinFun(vec![
762 BuiltinFunArg::Arg(String::from("X")),
763 BuiltinFunArg::Arg(String::from("Y"))
764 ]));
765 doc_root_mod.add_var(String::from("isless"), String::from(&doc[1..]));
766
767 let doc = r#"
768Returns `true` if the `X` value is greater than or equal to the `Y` value, otherwise `false`.
769
770This function compares two boolean values, two numbers, or two strings. The result of this
771function is `false` for two other values.
772"#;
773 sig_root_mod.add_var(String::from("isgreaterequal"), Sig::BuiltinFun(vec![
774 BuiltinFunArg::Arg(String::from("X")),
775 BuiltinFunArg::Arg(String::from("Y"))
776 ]));
777 doc_root_mod.add_var(String::from("isgreaterequal"), String::from(&doc[1..]));
778
779 let doc = r#"
780Returns `true` if the `X` value is greater than the `Y` value, otherwise `false`.
781
782This function compares two boolean values, two numbers, or two strings. The result of this
783function is `false` for two other values.
784"#;
785 sig_root_mod.add_var(String::from("isgreater"), Sig::BuiltinFun(vec![
786 BuiltinFunArg::Arg(String::from("X")),
787 BuiltinFunArg::Arg(String::from("Y"))
788 ]));
789 doc_root_mod.add_var(String::from("isgreater"), String::from(&doc[1..]));
790
791 let doc = r#"
792Returns `true` if the `X` value is less than or equal to the `Y` value, otherwise `false`.
793
794This function compares two boolean values, two numbers, or two strings. The result of this
795function is `false` for two other values.
796"#;
797 sig_root_mod.add_var(String::from("islessequal"), Sig::BuiltinFun(vec![
798 BuiltinFunArg::Arg(String::from("X")),
799 BuiltinFunArg::Arg(String::from("Y"))
800 ]));
801 doc_root_mod.add_var(String::from("islessequal"), String::from(&doc[1..]));
802
803 let doc = r#"
804Calculates sigmoid function for the `X` value ($\operatorname{sigmoid}(\mathbf{X})$).
805
806This function is a mathematical function that takes a number, a matrix, or a mutable object.
807"#;
808 sig_root_mod.add_var(String::from("sigmoid"), Sig::BuiltinFun(vec![
809 BuiltinFunArg::Arg(String::from("X"))
810 ]));
811 doc_root_mod.add_var(String::from("sigmoid"), String::from(&doc[1..]));
812
813 let doc = r#"
814Calculates hyperbolic tangent for the `X` value ($\tanh(\mathbf{X})$).
815
816This function is a mathematical function that takes a number, a matrix, or a mutable object.
817"#;
818 sig_root_mod.add_var(String::from("tanh"), Sig::BuiltinFun(vec![
819 BuiltinFunArg::Arg(String::from("X"))
820 ]));
821 doc_root_mod.add_var(String::from("tanh"), String::from(&doc[1..]));
822
823 let doc = r#"
824Calculates swish function for the `X` value ($\operatorname{swish}(\mathbf{X})$).
825
826This function is a mathematical function that takes a number, a matrix, or a mutable object.
827"#;
828 sig_root_mod.add_var(String::from("swish"), Sig::BuiltinFun(vec![
829 BuiltinFunArg::Arg(String::from("X"))
830 ]));
831 doc_root_mod.add_var(String::from("swish"), String::from(&doc[1..]));
832
833 let doc = r#"
834Calculates softmax function for the `X` value ($\operatorname{softmax}(\mathbf{X})$).
835
836This function is a mathematical function that takes a number, a matrix, or a mutable object.
837"#;
838 sig_root_mod.add_var(String::from("softmax"), Sig::BuiltinFun(vec![
839 BuiltinFunArg::Arg(String::from("X"))
840 ]));
841 doc_root_mod.add_var(String::from("softmax"), String::from(&doc[1..]));
842
843 let doc = r#"
844Calculates square root of the `X` value ($\sqrt{x}$ or $\sqrt{x_{ij}}$).
845
846This function is a mathematical function that takes a number, a matrix, or a mutable object.
847"#;
848 sig_root_mod.add_var(String::from("sqrt"), Sig::BuiltinFun(vec![
849 BuiltinFunArg::Arg(String::from("X"))
850 ]));
851 doc_root_mod.add_var(String::from("sqrt"), String::from(&doc[1..]));
852
853 let doc = r#"
854Indeed transposes the `X` matrix (${\mathbf{X}}^\top$).
855"#;
856 sig_root_mod.add_var(String::from("reallytranspose"), Sig::BuiltinFun(vec![
857 BuiltinFunArg::Arg(String::from("X"))
858 ]));
859 doc_root_mod.add_var(String::from("reallytranspose"), String::from(&doc[1..]));
860
861 let doc = r#"
862This function is alias to the [`reallytranspose`](#var.reallytranspose) function.
863"#;
864 sig_root_mod.add_var(String::from("rt"), Sig::BuiltinFun(vec![
865 BuiltinFunArg::Arg(String::from("X"))
866 ]));
867 doc_root_mod.add_var(String::from("rt"), String::from(&doc[1..]));
868
869 let doc = r#"
870Repeats the `x` vector as column or row.
871"#;
872 sig_root_mod.add_var(String::from("repeat"), Sig::BuiltinFun(vec![
873 BuiltinFunArg::Arg(String::from("x"))
874 ]));
875 doc_root_mod.add_var(String::from("repeat"), String::from(&doc[1..]));
876
877 let doc = r#"
878Calculates remainder of division the `x` value by the `y` value ($\operatorname{mod}(x, y)$).
879
880If the `x` value and the `y` value are integer numbers, this function also returns an integer
881number.
882"#;
883 sig_root_mod.add_var(String::from("mod"), Sig::BuiltinFun(vec![
884 BuiltinFunArg::Arg(String::from("x")),
885 BuiltinFunArg::Arg(String::from("y"))
886 ]));
887 doc_root_mod.add_var(String::from("mod"), String::from(&doc[1..]));
888
889 let doc = r#"
890Calculates absolute value of the `X` value ($|x|$ or $|x_{ij}|$).
891
892This function is a mathematical function that takes a number, a matrix, or a mutable object. If
893the `X` value is an integer number, this function also returns an integer value.
894"#;
895 sig_root_mod.add_var(String::from("abs"), Sig::BuiltinFun(vec![
896 BuiltinFunArg::Arg(String::from("X"))
897 ]));
898 doc_root_mod.add_var(String::from("abs"), String::from(&doc[1..]));
899
900 let doc = r#"
901Raises the `X` value to the power of the `Y` value ($x^y$, ${x_{ij}}^y$, $x^{y_{ij}}$, or
902${x_{ij}}^{y_{ij}}$).
903
904This function is a mathematical function that takes two arguments. This argument can be a number,
905a matrix, or a mutable object. These arguments can't be a matrix and a mutable object.
906"#;
907 sig_root_mod.add_var(String::from("pow"), Sig::BuiltinFun(vec![
908 BuiltinFunArg::Arg(String::from("X")),
909 BuiltinFunArg::Arg(String::from("Y"))
910 ]));
911 doc_root_mod.add_var(String::from("pow"), String::from(&doc[1..]));
912
913 let doc = r#"
914Calculates exponentional function of the `X` value ($e^x$ or $e^{x_{ij}}$).
915
916This function is a mathematical function that takes a number, a matrix, or a mutable object.
917"#;
918 sig_root_mod.add_var(String::from("exp"), Sig::BuiltinFun(vec![
919 BuiltinFunArg::Arg(String::from("X"))
920 ]));
921 doc_root_mod.add_var(String::from("exp"), String::from(&doc[1..]));
922
923 let doc = r#"
924Calculates natural logarithm of the `X` value ($\ln{x}$ or $\ln{x_{ij}}$).
925
926This function is a mathematical function that takes a number, a matrix, or a mutable object.
927"#;
928 sig_root_mod.add_var(String::from("log"), Sig::BuiltinFun(vec![
929 BuiltinFunArg::Arg(String::from("X"))
930 ]));
931 doc_root_mod.add_var(String::from("log"), String::from(&doc[1..]));
932
933 let doc = r#"
934Calculates base 2 logarithm of the `X` value ($\log_2{x}$ or $\log_2{x_{ij}}$).
935
936This function is a mathematical function that takes a number, a matrix, or a mutable object.
937"#;
938 sig_root_mod.add_var(String::from("log2"), Sig::BuiltinFun(vec![
939 BuiltinFunArg::Arg(String::from("X"))
940 ]));
941 doc_root_mod.add_var(String::from("log2"), String::from(&doc[1..]));
942
943 let doc = r#"
944Calculates base 10 logarithm of the `X` value ($\log_10{x}$ or $\log_10{x_{ij}}$).
945
946This function is a mathematical function that takes a number, a matrix, or a mutable object.
947"#;
948 sig_root_mod.add_var(String::from("log10"), Sig::BuiltinFun(vec![
949 BuiltinFunArg::Arg(String::from("X"))
950 ]));
951 doc_root_mod.add_var(String::from("log10"), String::from(&doc[1..]));
952
953 let doc = r#"
954Calculates sine function for the `X` value ($\sin(\mathbf{X})$).
955
956This function is a mathematical function that takes a number, a matrix, or a mutable object.
957"#;
958 sig_root_mod.add_var(String::from("sin"), Sig::BuiltinFun(vec![
959 BuiltinFunArg::Arg(String::from("X"))
960 ]));
961 doc_root_mod.add_var(String::from("sin"), String::from(&doc[1..]));
962
963 let doc = r#"
964Calculates cosine function for the `X` value ($\cos(\mathbf{X})$).
965
966This function is a mathematical function that takes a number, a matrix, or a mutable object.
967"#;
968 sig_root_mod.add_var(String::from("cos"), Sig::BuiltinFun(vec![
969 BuiltinFunArg::Arg(String::from("X"))
970 ]));
971 doc_root_mod.add_var(String::from("cos"), String::from(&doc[1..]));
972
973 let doc = r#"
974Calculates tangent function for the `X` value ($\tan(\mathbf{X})$).
975
976This function is a mathematical function that takes a number, a matrix, or a mutable object.
977"#;
978 sig_root_mod.add_var(String::from("tan"), Sig::BuiltinFun(vec![
979 BuiltinFunArg::Arg(String::from("X"))
980 ]));
981 doc_root_mod.add_var(String::from("tan"), String::from(&doc[1..]));
982
983 let doc = r#"
984Calculates arcsine function for the `X` value ($\arcsin(\mathbf{X})$).
985
986This function is a mathematical function that takes a number, a matrix, or a mutable object.
987"#;
988 sig_root_mod.add_var(String::from("asin"), Sig::BuiltinFun(vec![
989 BuiltinFunArg::Arg(String::from("X"))
990 ]));
991 doc_root_mod.add_var(String::from("asin"), String::from(&doc[1..]));
992
993 let doc = r#"
994Calculates arccosine function for the `X` value ($\arccos(\mathbf{X})$).
995
996This function is a mathematical function that takes a number, a matrix, or a mutable object.
997"#;
998 sig_root_mod.add_var(String::from("acos"), Sig::BuiltinFun(vec![
999 BuiltinFunArg::Arg(String::from("X"))
1000 ]));
1001 doc_root_mod.add_var(String::from("acos"), String::from(&doc[1..]));
1002
1003 let doc = r#"
1004Calculates arctangent function for the `X` value ($\arctan(\mathbf{X})$).
1005
1006This function is a mathematical function that takes a number, a matrix, or a mutable object.
1007"#;
1008 sig_root_mod.add_var(String::from("atan"), Sig::BuiltinFun(vec![
1009 BuiltinFunArg::Arg(String::from("X"))
1010 ]));
1011 doc_root_mod.add_var(String::from("atan"), String::from(&doc[1..]));
1012
1013 let doc = r#"
1014Calculates arctangent function for the `X` value and the `Y` value ($\arctan(\frac{x}{y})$,
1015$\arctan(\frac{x_{ij}}{y})$, $\arctan(\frac{x}{y_{ij}})$, or $\arctan(\frac{x_{ij}}{y_{ij}})$).
1016
1017This function is a mathematical function that takes two arguments. This argument can be a number,
1018a matrix, or a mutable object. These arguments can't be a matrix and a mutable object.
1019"#;
1020 sig_root_mod.add_var(String::from("atan2"), Sig::BuiltinFun(vec![
1021 BuiltinFunArg::Arg(String::from("X"))
1022 ]));
1023 doc_root_mod.add_var(String::from("atan2"), String::from(&doc[1..]));
1024
1025 let doc = r#"
1026Calculates hyperbolic sine function for the `X` value ($\sinh(\mathbf{X})$).
1027
1028This function is a mathematical function that takes a number, a matrix, or a mutable object.
1029"#;
1030 sig_root_mod.add_var(String::from("sinh"), Sig::BuiltinFun(vec![
1031 BuiltinFunArg::Arg(String::from("X"))
1032 ]));
1033 doc_root_mod.add_var(String::from("sinh"), String::from(&doc[1..]));
1034
1035 let doc = r#"
1036Calculates hyperbolic cosine function for the `X` value ($\cosh(\mathbf{X})$).
1037
1038This function is a mathematical function that takes a number, a matrix, or a mutable object.
1039"#;
1040 sig_root_mod.add_var(String::from("cosh"), Sig::BuiltinFun(vec![
1041 BuiltinFunArg::Arg(String::from("X"))
1042 ]));
1043 doc_root_mod.add_var(String::from("cosh"), String::from(&doc[1..]));
1044
1045 let doc = r#"
1046Calculates inverse hyperbolic sine function for the `X` value
1047($\operatorname{arsinh}(\mathbf{X})$).
1048
1049This function is a mathematical function that takes a number, a matrix, or a mutable object.
1050"#;
1051 sig_root_mod.add_var(String::from("asinh"), Sig::BuiltinFun(vec![
1052 BuiltinFunArg::Arg(String::from("X"))
1053 ]));
1054 doc_root_mod.add_var(String::from("asinh"), String::from(&doc[1..]));
1055
1056 let doc = r#"
1057Calculates inverse hyperbolic cosine function for the `X` value
1058($\operatorname{arcosh}(\mathbf{X})$).
1059
1060This function is a mathematical function that takes a number, a matrix, or a mutable object.
1061"#;
1062 sig_root_mod.add_var(String::from("acosh"), Sig::BuiltinFun(vec![
1063 BuiltinFunArg::Arg(String::from("X"))
1064 ]));
1065 doc_root_mod.add_var(String::from("acosh"), String::from(&doc[1..]));
1066
1067 let doc = r#"
1068Calculates inverse hyperbolic tangent function for the `X` value
1069($\operatorname{artanh}(\mathbf{X})$).
1070
1071This function is a mathematical function that takes a number, a matrix, or a mutable object.
1072"#;
1073 sig_root_mod.add_var(String::from("atanh"), Sig::BuiltinFun(vec![
1074 BuiltinFunArg::Arg(String::from("X"))
1075 ]));
1076 doc_root_mod.add_var(String::from("atanh"), String::from(&doc[1..]));
1077
1078 let doc = r#"
1079Calculates signum function for the `X` value ($\operatorname{sgn}(\mathbf{X})$).
1080
1081This function is a mathematical function that takes a number, a matrix, or a mutable object.
1082"#;
1083 sig_root_mod.add_var(String::from("sign"), Sig::BuiltinFun(vec![
1084 BuiltinFunArg::Arg(String::from("X"))
1085 ]));
1086 doc_root_mod.add_var(String::from("sign"), String::from(&doc[1..]));
1087
1088 let doc = r#"
1089Calculates ceil function for the `X` value ($\operatorname{ceil}(\mathbf{X})$).
1090
1091This function is a mathematical function that takes a number, a matrix, or a mutable object.
1092"#;
1093 sig_root_mod.add_var(String::from("ceil"), Sig::BuiltinFun(vec![
1094 BuiltinFunArg::Arg(String::from("X"))
1095 ]));
1096 doc_root_mod.add_var(String::from("ceil"), String::from(&doc[1..]));
1097
1098 let doc = r#"
1099Calculates floor function for the `X` value ($\operatorname{floor}(\mathbf{X})$).
1100
1101This function is a mathematical function that takes a number, a matrix, or a mutable object.
1102"#;
1103 sig_root_mod.add_var(String::from("floor"), Sig::BuiltinFun(vec![
1104 BuiltinFunArg::Arg(String::from("X"))
1105 ]));
1106 doc_root_mod.add_var(String::from("floor"), String::from(&doc[1..]));
1107
1108 let doc = r#"
1109Calculates round function for the `X` value ($\operatorname{round}(\mathbf{X})$).
1110
1111This function is a mathematical function that takes a number, a matrix, or a mutable object.
1112"#;
1113 sig_root_mod.add_var(String::from("round"), Sig::BuiltinFun(vec![
1114 BuiltinFunArg::Arg(String::from("X"))
1115 ]));
1116 doc_root_mod.add_var(String::from("round"), String::from(&doc[1..]));
1117
1118 let doc = r#"
1119Calculates trunc function for the `X` value ($\operatorname{trunc}(\mathbf{X})$).
1120
1121This function is a mathematical function that takes a number, a matrix, or a mutable object.
1122"#;
1123 sig_root_mod.add_var(String::from("trunc"), Sig::BuiltinFun(vec![
1124 BuiltinFunArg::Arg(String::from("X"))
1125 ]));
1126 doc_root_mod.add_var(String::from("trunc"), String::from(&doc[1..]));
1127
1128 let doc = r#"
1129Generates a random floating-point number in range $[0, 1)$.
1130"#;
1131 sig_root_mod.add_var(String::from("rand"), Sig::BuiltinFun(vec![]));
1132 doc_root_mod.add_var(String::from("rand"), String::from(&doc[1..]));
1133
1134 let doc = r#"
1135Generates a random integer number in range $[1, N]$ or range $[N, M]$.
1136"#;
1137 sig_root_mod.add_var(String::from("randi"), Sig::BuiltinFun(vec![
1138 BuiltinFunArg::Arg(String::from("N")),
1139 BuiltinFunArg::OptArg(String::from("M"))
1140 ]));
1141 doc_root_mod.add_var(String::from("randi"), String::from(&doc[1..]));
1142
1143 let doc = r#"
1144Converts the `s` string to an integer number.
1145
1146If the `s` string can be converted to the integer number, this function returns an error with the
1147`"parseint"` error kind.
1148"#;
1149 sig_root_mod.add_var(String::from("str2int"), Sig::BuiltinFun(vec![
1150 BuiltinFunArg::Arg(String::from("s"))
1151 ]));
1152 doc_root_mod.add_var(String::from("str2int"), String::from(&doc[1..]));
1153
1154 let doc = r#"
1155Converts the `s` string to a floating-point number.
1156
1157If the `s` string can be converted to the floating-point number, this function returns an error
1158with the `"parsefloat"` error kind.
1159"#;
1160 sig_root_mod.add_var(String::from("str2int"), Sig::BuiltinFun(vec![
1161 BuiltinFunArg::Arg(String::from("s"))
1162 ]));
1163 doc_root_mod.add_var(String::from("str2int"), String::from(&doc[1..]));
1164
1165 let doc = r#"
1166Converts the hexadecimal number as the `s` string to a decimal integer number.
1167
1168If the `s` string can be converted to the decimal integer number, this function returns an error
1169with the error kind `"parseint"`.
1170"#;
1171 sig_root_mod.add_var(String::from("hex2dec"), Sig::BuiltinFun(vec![
1172 BuiltinFunArg::Arg(String::from("s"))
1173 ]));
1174 doc_root_mod.add_var(String::from("hex2dec"), String::from(&doc[1..]));
1175
1176 let doc = r#"
1177Converts the first character of the `s` string to a character code as an integer number.
1178
1179If the `s` string is empty, this function returns `none`.
1180"#;
1181 sig_root_mod.add_var(String::from("char2code"), Sig::BuiltinFun(vec![
1182 BuiltinFunArg::Arg(String::from("s"))
1183 ]));
1184 doc_root_mod.add_var(String::from("char2code"), String::from(&doc[1..]));
1185
1186 let doc = r#"
1187Converts the character code as the `x` integer number to the string with the character.
1188
1189If the `x` character code is invalid, this function returns `none`.
1190"#;
1191 sig_root_mod.add_var(String::from("code2char"), Sig::BuiltinFun(vec![
1192 BuiltinFunArg::Arg(String::from("x"))
1193 ]));
1194 doc_root_mod.add_var(String::from("code2char"), String::from(&doc[1..]));
1195
1196 let doc = r#"
1197Formats the `millis` number of milliseconds according to the `fmt` format.
1198
1199The formats with examples are:
1200
1201- `"s"` - seconds for exmaple `"1234.567s"`
1202- `"ms"` - minutes and seconds for example `"12m34.567s"`
1203- `"hms"` - hours, minutes, and seconds for example `"12h34m56.789s"`
1204
1205If the `fmt` format is invalid, this function returns an error with the `"format"` error kind.
1206"#;
1207 sig_root_mod.add_var(String::from("formatmillis"), Sig::BuiltinFun(vec![
1208 BuiltinFunArg::Arg(String::from("fmt")),
1209 BuiltinFunArg::Arg(String::from("millis"))
1210 ]));
1211 doc_root_mod.add_var(String::from("formatmillis"), String::from(&doc[1..]));
1212
1213 let doc = r#"
1214Formats the `X` value according to the `width` width and the `align` alignment.
1215
1216If the string of the `X` value has a number of characters less than the `width` width, the string
1217of `X` value is padded with spaces according to the `align` alignment. The alignments are:
1218
1219- `"left"` - left alignment
1220- `"center"` - center alignment
1221- `"right"` - right alignment
1222
1223If the `align` alignment isn't passed, this function uses the left alignment for the string of
1224the `X` value by default. If the `width` width and/or the `align` alignment are/is invalid, this
1225function returns an error with the `"format"` error kind.
1226"#;
1227 sig_root_mod.add_var(String::from("withwidth"), Sig::BuiltinFun(vec![
1228 BuiltinFunArg::Arg(String::from("X")),
1229 BuiltinFunArg::Arg(String::from("width")),
1230 BuiltinFunArg::OptArg(String::from("align"))
1231 ]));
1232 doc_root_mod.add_var(String::from("withwidth"), String::from(&doc[1..]));
1233
1234 let doc = r#"
1235Formats the `X` value with the zero padding according to the `width` width.
1236
1237If the string of the `X` value has a number of characters less than the `width` width, the string
1238of `X` value is padded with zeros according to the right alignment. If the `width` width is
1239invalid, this function returns an error with the `"format"` error kind.
1240"#;
1241 sig_root_mod.add_var(String::from("withzeros"), Sig::BuiltinFun(vec![
1242 BuiltinFunArg::Arg(String::from("X")),
1243 BuiltinFunArg::Arg(String::from("width"))
1244 ]));
1245 doc_root_mod.add_var(String::from("withzeros"), String::from(&doc[1..]));
1246
1247 let doc = r#"
1248Reads a line from the standard input.
1249
1250If an I/O error occurs while this operation, this function returns an error with the `"io"` error
1251kind.
1252"#;
1253 sig_root_mod.add_var(String::from("readline"), Sig::BuiltinFun(vec![]));
1254 doc_root_mod.add_var(String::from("readline"), String::from(&doc[1..]));
1255
1256 let doc = r#"
1257Formats the values and then returns the formatted values as a string.
1258"#;
1259 sig_root_mod.add_var(String::from("format"), Sig::BuiltinFun(vec![
1260 BuiltinFunArg::OptArg(String::from("X")),
1261 BuiltinFunArg::DotDotDot
1262 ]));
1263 doc_root_mod.add_var(String::from("format"), String::from(&doc[1..]));
1264
1265 let doc = r#"
1266Prints the values to the standard output.
1267"#;
1268 sig_root_mod.add_var(String::from("print"), Sig::BuiltinFun(vec![
1269 BuiltinFunArg::OptArg(String::from("X")),
1270 BuiltinFunArg::DotDotDot
1271 ]));
1272 doc_root_mod.add_var(String::from("print"), String::from(&doc[1..]));
1273
1274 let doc = r#"
1275Prints the values with the newline character to the standard output.
1276"#;
1277 sig_root_mod.add_var(String::from("println"), Sig::BuiltinFun(vec![
1278 BuiltinFunArg::OptArg(String::from("X")),
1279 BuiltinFunArg::DotDotDot
1280 ]));
1281 doc_root_mod.add_var(String::from("println"), String::from(&doc[1..]));
1282
1283 let doc = r#"
1284Prints the values to the standard error.
1285"#;
1286 sig_root_mod.add_var(String::from("eprint"), Sig::BuiltinFun(vec![
1287 BuiltinFunArg::OptArg(String::from("X")),
1288 BuiltinFunArg::DotDotDot
1289 ]));
1290 doc_root_mod.add_var(String::from("eprint"), String::from(&doc[1..]));
1291
1292 let doc = r#"
1293Prints the values with the newline character to the standard error.
1294"#;
1295 sig_root_mod.add_var(String::from("eprintln"), Sig::BuiltinFun(vec![
1296 BuiltinFunArg::OptArg(String::from("X")),
1297 BuiltinFunArg::DotDotDot
1298 ]));
1299 doc_root_mod.add_var(String::from("eprintln"), String::from(&doc[1..]));
1300
1301 let doc = r#"
1302Flushes the stream of standard output.
1303
1304This function writes all unwritten buffered data in the stream of standard output to the standard
1305output. Also, this function returns `true` if an I/O error doesn't occur while this operation,
1306otherwise an error with the `"io"` error kind.
1307"#;
1308 sig_root_mod.add_var(String::from("flush"), Sig::BuiltinFun(vec![]));
1309 doc_root_mod.add_var(String::from("flush"), String::from(&doc[1..]));
1310
1311 let doc = r#"
1312Flushes the stream of standard error.
1313
1314This function writes all unwritten buffered data in the stream of standard error to the standard
1315error. Also, this function returns `true` if an I/O error doesn't occur while this operation,
1316otherwise an error with the `"io"` error kind.
1317"#;
1318 sig_root_mod.add_var(String::from("eflush"), Sig::BuiltinFun(vec![]));
1319 doc_root_mod.add_var(String::from("eflush"), String::from(&doc[1..]));
1320
1321 let doc = r#"
1322Changes the current working directory to the `path` directory.
1323
1324This function returns `true` if an I/O error doesn't occur while this operation, otherwise an
1325error with the `"io"` error kind.
1326"#;
1327 sig_root_mod.add_var(String::from("cd"), Sig::BuiltinFun(vec![
1328 BuiltinFunArg::Arg(String::from("path"))
1329 ]));
1330 doc_root_mod.add_var(String::from("cd"), String::from(&doc[1..]));
1331
1332 let doc = r#"
1333Returns the path of current working directory.
1334
1335If an I/O error occur while this operation, this function returns an error with the `"io"` error
1336kind.
1337"#;
1338 sig_root_mod.add_var(String::from("pwd"), Sig::BuiltinFun(vec![]));
1339 doc_root_mod.add_var(String::from("pwd"), String::from(&doc[1..]));
1340
1341 let doc = r#"
1342Returns `true` if the `path` file exists, otherwise `false`.
1343
1344If an I/O error occur while this operation, this function returns an error with the `"io"` error
1345kind.
1346"#;
1347 sig_root_mod.add_var(String::from("exist"), Sig::BuiltinFun(vec![
1348 BuiltinFunArg::Arg(String::from("path"))
1349 ]));
1350 doc_root_mod.add_var(String::from("exist"), String::from(&doc[1..]));
1351
1352 let doc = r#"
1353Returns a file type as a string for the `path` file.
1354
1355The file types are:
1356
1357- `"dir"` - directory
1358- `"file"` - any file except directory
1359
1360If an I/O error occur while this operation, this function returns an error with the `"io"` error
1361kind.
1362"#;
1363 sig_root_mod.add_var(String::from("filetype"), Sig::BuiltinFun(vec![
1364 BuiltinFunArg::Arg(String::from("path"))
1365 ]));
1366 doc_root_mod.add_var(String::from("filetype"), String::from(&doc[1..]));
1367
1368 let doc = r#"
1369Returns file names in the `path` directory.
1370
1371If an I/O error occur while this operation, this function returns an error with the `"io"` error
1372kind.
1373"#;
1374 sig_root_mod.add_var(String::from("dir"), Sig::BuiltinFun(vec![
1375 BuiltinFunArg::Arg(String::from("path"))
1376 ]));
1377 doc_root_mod.add_var(String::from("dir"), String::from(&doc[1..]));
1378
1379 let doc = r#"
1380This function is alias to the [`dir`](#var.dir) function.
1381"#;
1382 sig_root_mod.add_var(String::from("ls"), Sig::BuiltinFun(vec![
1383 BuiltinFunArg::Arg(String::from("path"))
1384 ]));
1385 doc_root_mod.add_var(String::from("ls"), String::from(&doc[1..]));
1386
1387 let doc = r#"
1388Creates a `path` directory.
1389
1390This function returns `true` if an I/O error doesn't occur while this operation, otherwise an
1391error with the `"io"` error kind.
1392"#;
1393 sig_root_mod.add_var(String::from("mkdir"), Sig::BuiltinFun(vec![
1394 BuiltinFunArg::Arg(String::from("path"))
1395 ]));
1396 doc_root_mod.add_var(String::from("mkdir"), String::from(&doc[1..]));
1397
1398 let doc = r#"
1399Removes the `path` directory.
1400
1401This function returns `true` if an I/O error doesn't occur while this operation, otherwise an
1402error with the `"io"` error kind.
1403"#;
1404 sig_root_mod.add_var(String::from("rmdir"), Sig::BuiltinFun(vec![
1405 BuiltinFunArg::Arg(String::from("path"))
1406 ]));
1407 doc_root_mod.add_var(String::from("rmdir"), String::from(&doc[1..]));
1408
1409 let doc = r#"
1410Removes the `path` file.
1411
1412This function returns `true` if an I/O error doesn't occur while this operation, otherwise an
1413error with the `"io"` error kind.
1414"#;
1415 sig_root_mod.add_var(String::from("rmfile"), Sig::BuiltinFun(vec![
1416 BuiltinFunArg::Arg(String::from("path"))
1417 ]));
1418 doc_root_mod.add_var(String::from("rmfile"), String::from(&doc[1..]));
1419
1420 let doc = r#"
1421Copies the content of the `srcpath` file with the permissions to the `dstpath` file.
1422
1423This function overwrites the content of the `dstpath` file if the `dstpath` file already exists.
1424Also, this function returns `true` if an I/O error doesn't occur while this operation, otherwise
1425an error with the `"io"` error kind.
1426"#;
1427 sig_root_mod.add_var(String::from("copy"), Sig::BuiltinFun(vec![
1428 BuiltinFunArg::Arg(String::from("srcpath")),
1429 BuiltinFunArg::Arg(String::from("dstpath"))
1430 ]));
1431 doc_root_mod.add_var(String::from("copy"), String::from(&doc[1..]));
1432
1433 let doc = r#"
1434Renames the `oldpath` file to the `newpath` name.
1435
1436This function replaces the `newpath` file if the `newpath` file already exists. Also, this
1437function returns `true` if an I/O error doesn't occur while this operation, otherwise an error
1438with the `"io"` error kind.
1439"#;
1440 sig_root_mod.add_var(String::from("rename"), Sig::BuiltinFun(vec![
1441 BuiltinFunArg::Arg(String::from("oldpath")),
1442 BuiltinFunArg::Arg(String::from("newpath"))
1443 ]));
1444 doc_root_mod.add_var(String::from("rename"), String::from(&doc[1..]));
1445
1446 let doc = r#"
1447Executes the command with the `cmdname` command name and the arguments as a child process.
1448
1449This function returns the exit code if an I/O error doesn't occur while this operation, otherwise
1450an error with the `"io"` error kind. Also, this function returns an error with the `"exitstatus"`
1451error kind if child process terminated by signal.
1452"#;
1453 sig_root_mod.add_var(String::from("spawn"), Sig::BuiltinFun(vec![
1454 BuiltinFunArg::Arg(String::from("cmdname")),
1455 BuiltinFunArg::OptArg(String::from("arg")),
1456 BuiltinFunArg::DotDotDot
1457 ]));
1458 doc_root_mod.add_var(String::from("spawn"), String::from(&doc[1..]));
1459
1460 let doc = r#"
1461Terminates the current process with the `exitcode` exit code.
1462"#;
1463 sig_root_mod.add_var(String::from("exit"), Sig::BuiltinFun(vec![
1464 BuiltinFunArg::Arg(String::from("exitcode"))
1465 ]));
1466 doc_root_mod.add_var(String::from("exit"), String::from(&doc[1..]));
1467
1468 let doc = r#"
1469Loads values from the `path` file in the binary format.
1470
1471This function returns the loaded values if an I/O error doesn't occur while this operation,
1472otherwise an error with the `"io"` error kind.
1473"#;
1474 sig_root_mod.add_var(String::from("load"), Sig::BuiltinFun(vec![
1475 BuiltinFunArg::Arg(String::from("path"))
1476 ]));
1477 doc_root_mod.add_var(String::from("load"), String::from(&doc[1..]));
1478
1479 let doc = r#"
1480Saves the values to the `path` file in the binary format.
1481
1482This function returns `true` if an I/O error doesn't occur while this operation, otherwise an
1483error with the `"io"` error kind.
1484"#;
1485 sig_root_mod.add_var(String::from("save"), Sig::BuiltinFun(vec![
1486 BuiltinFunArg::Arg(String::from("path")),
1487 BuiltinFunArg::OptArg(String::from("X")),
1488 BuiltinFunArg::DotDotDot
1489 ]));
1490 doc_root_mod.add_var(String::from("save"), String::from(&doc[1..]));
1491
1492 let doc = r#"
1493Loads a string from the `path` text file.
1494
1495This function returns the loaded string if an I/O error doesn't occur while this operation,
1496otherwise an error with the `"io"` error kind.
1497"#;
1498 sig_root_mod.add_var(String::from("loadstr"), Sig::BuiltinFun(vec![
1499 BuiltinFunArg::Arg(String::from("path"))
1500 ]));
1501 doc_root_mod.add_var(String::from("loadstr"), String::from(&doc[1..]));
1502
1503 let doc = r#"
1504Saves the `s` string to the `path` text file.
1505
1506This function returns `true` if an I/O error doesn't occur while this operation, otherwise an
1507error with the `"io"` error kind.
1508"#;
1509 sig_root_mod.add_var(String::from("savestr"), Sig::BuiltinFun(vec![
1510 BuiltinFunArg::Arg(String::from("path")),
1511 BuiltinFunArg::Arg(String::from("s"))
1512 ]));
1513 doc_root_mod.add_var(String::from("savestr"), String::from(&doc[1..]));
1514
1515 let doc = r#"
1516Loads a value from the `path` file in the [TOML](https://en.wikipedia.org/wiki/TOML) format.
1517
1518This function returns the loaded value if an error doesn't occur while this operation, otherwise
1519an error with the `"io"` error kind or the `"toml"` kind error.
1520"#;
1521 sig_root_mod.add_var(String::from("loadtoml"), Sig::BuiltinFun(vec![
1522 BuiltinFunArg::Arg(String::from("path"))
1523 ]));
1524 doc_root_mod.add_var(String::from("loadtoml"), String::from(&doc[1..]));
1525
1526 let doc = r#"
1527Saves the `X` value to the `path` file in the [TOML](https://en.wikipedia.org/wiki/TOML) format.
1528
1529This function returns `true` if an error doesn't occur while this operation, otherwise an error
1530with the `"io"` error kind or the `"toml"` error kind.
1531"#;
1532 sig_root_mod.add_var(String::from("savetoml"), Sig::BuiltinFun(vec![
1533 BuiltinFunArg::Arg(String::from("path")),
1534 BuiltinFunArg::Arg(String::from("X"))
1535 ]));
1536 doc_root_mod.add_var(String::from("savetoml"), String::from(&doc[1..]));
1537
1538 let doc = r#"
1539Loads a value from the `path` file in the [JSON](https://en.wikipedia.org/wiki/JSON) format.
1540
1541This function returns the loaded value if an error doesn't occur while this operation, otherwise
1542an error with the `"io"` error kind or the `"json"` kind error.
1543"#;
1544 sig_root_mod.add_var(String::from("loadjson"), Sig::BuiltinFun(vec![
1545 BuiltinFunArg::Arg(String::from("path"))
1546 ]));
1547 doc_root_mod.add_var(String::from("loadjson"), String::from(&doc[1..]));
1548
1549 let doc = r#"
1550Saves the `X` value to the `path` file in the [JSON](https://en.wikipedia.org/wiki/JSON) format.
1551
1552This function returns `true` if an error doesn't occur while this operation, otherwise an error
1553with the `"io"` error kind or the `"json"` error kind.
1554"#;
1555 sig_root_mod.add_var(String::from("savejson"), Sig::BuiltinFun(vec![
1556 BuiltinFunArg::Arg(String::from("path")),
1557 BuiltinFunArg::Arg(String::from("X"))
1558 ]));
1559 doc_root_mod.add_var(String::from("savejson"), String::from(&doc[1..]));
1560
1561 let doc = r#"
1562Returns the arguments which are passed for this script.
1563"#;
1564 sig_root_mod.add_var(String::from("args"), Sig::BuiltinFun(vec![]));
1565 doc_root_mod.add_var(String::from("args"), String::from(&doc[1..]));
1566
1567 let doc = r#"
1568Returns the environment variables of current process as strings.
1569"#;
1570 sig_root_mod.add_var(String::from("env"), Sig::BuiltinFun(vec![]));
1571 doc_root_mod.add_var(String::from("env"), String::from(&doc[1..]));
1572
1573 let doc = r#"
1574Returns the path to the script directory.
1575"#;
1576 sig_root_mod.add_var(String::from("scriptdir"), Sig::BuiltinFun(vec![]));
1577 doc_root_mod.add_var(String::from("scriptdir"), String::from(&doc[1..]));
1578
1579 let doc = r#"
1580Returns the library paths as the string.
1581"#;
1582 sig_root_mod.add_var(String::from("libpath"), Sig::BuiltinFun(vec![]));
1583 doc_root_mod.add_var(String::from("libpath"), String::from(&doc[1..]));
1584
1585 let doc = r#"
1586Returns the domain of current library if interpreter is in the libary, otherwise `None`.
1587"#;
1588 sig_root_mod.add_var(String::from("domain"), Sig::BuiltinFun(vec![]));
1589 doc_root_mod.add_var(String::from("domain"), String::from(&doc[1..]));
1590
1591 let doc = r#"
1592Loads the library with the `libname` library name if the library isn't already loaded, otherwise
1593this function doesn't load the library.
1594
1595The library with the `libname` library name is loaded in the root module. The `libname` library
1596name should contain the domain and the name which are separeted by the `/` character. If the
1597`libname` library name hasn't the domain and the interpreter is in the library, this function
1598loads the library with the domain of current library.
1599"#;
1600 sig_root_mod.add_var(String::from("uselib"), Sig::BuiltinFun(vec![
1601 BuiltinFunArg::Arg(String::from("libname"))
1602 ]));
1603 doc_root_mod.add_var(String::from("uselib"), String::from(&doc[1..]));
1604
1605 let doc = r#"
1606Loads the library with the `libname` library name even if the library is already loaded.
1607
1608The library with the `libname` library name is loaded in the root module. The `libname` library
1609name should contain the domain and the name which are separeted by the `/` character. If the
1610`libname` library name hasn't the domain and the interpreter is in the library, this function
1611loads the library with the domain of current library.
1612"#;
1613 sig_root_mod.add_var(String::from("reuselib"), Sig::BuiltinFun(vec![
1614 BuiltinFunArg::Arg(String::from("libname"))
1615 ]));
1616 doc_root_mod.add_var(String::from("reuselib"), String::from(&doc[1..]));
1617
1618 let doc = r#"
1619Runs the script that is refers by the `path` path.
1620
1621If the `path` path is relative, the script is runned from the script directory. The script is
1622runned in the current module. The `/` path separators can be used in the `path` path regardless
1623of the operating system because the `/` path separators are replaced to the system path
1624separators.
1625"#;
1626 sig_root_mod.add_var(String::from("run"), Sig::BuiltinFun(vec![
1627 BuiltinFunArg::Arg(String::from("path"))
1628 ]));
1629 doc_root_mod.add_var(String::from("run"), String::from(&doc[1..]));
1630
1631 let doc = r#"
1632This function is alias to the [`run`](#var.run) function.
1633
1634This alias adds the documetation comments from the `path` file while documentation generation.
1635The `path` path should be a string literal so that documentation comment are added.
1636"#;
1637 sig_root_mod.add_var(String::from("runwithdoc"), Sig::BuiltinFun(vec![
1638 BuiltinFunArg::Arg(String::from("path"))
1639 ]));
1640 doc_root_mod.add_var(String::from("runwithdoc"), String::from(&doc[1..]));
1641
1642 let doc = r#"
1643Returns the elapsed time in milliseconds since an interpreter start.
1644"#;
1645 sig_root_mod.add_var(String::from("clock"), Sig::BuiltinFun(vec![]));
1646 doc_root_mod.add_var(String::from("clock"), String::from(&doc[1..]));
1647
1648 let doc = r#"
1649Imports the module with the `modname` name in the current module.
1650
1651If the `newident` identifier is passed, the module is imported as module with the `newident`
1652identifier. The `modname` name should contain the module identifiers which are separated by the
1653`::` character sequence. The first module identifier in the `modname` name can be the `root`
1654keyword that refers to the root module. The `modname` name can have the `::` prefix.
1655"#;
1656 sig_root_mod.add_var(String::from("usemod"), Sig::BuiltinFun(vec![
1657 BuiltinFunArg::Arg(String::from("modname")),
1658 BuiltinFunArg::OptArg(String::from("newident"))
1659 ]));
1660 doc_root_mod.add_var(String::from("usemod"), String::from(&doc[1..]));
1661
1662 let doc = r#"
1663Imports all modules from the module with the `modname` name in the current module.
1664
1665The `modname` name should contain the module identifiers which are separated by the `::`
1666character sequence. The first module identifier in the `modname` name can be the `root` keyword
1667that refers to the root module. The `modname` name can have the `::` prefix.
1668"#;
1669 sig_root_mod.add_var(String::from("usemods"), Sig::BuiltinFun(vec![
1670 BuiltinFunArg::Arg(String::from("modname"))
1671 ]));
1672 doc_root_mod.add_var(String::from("usemods"), String::from(&doc[1..]));
1673
1674 let doc = r#"
1675Imports the module with the `varname` name in the current module.
1676
1677If the `newident` identifier is passed, the variable is imported as module with the `newident`
1678identifier. The `varname` name should contain the module identifiers and/or the variable
1679identifier which are separated by the `::` character sequence. The first module identifier in the
1680`varname` name can be the `root` keyword that refers to the root module. The `varname` name can
1681have the `::` prefix.
1682"#;
1683 sig_root_mod.add_var(String::from("usevar"), Sig::BuiltinFun(vec![
1684 BuiltinFunArg::Arg(String::from("varname")),
1685 BuiltinFunArg::OptArg(String::from("newident"))
1686 ]));
1687 doc_root_mod.add_var(String::from("usevar"), String::from(&doc[1..]));
1688
1689 let doc = r#"
1690Imports all variables from the module with the `modname` name in the current module.
1691
1692The `modname` name should contain the module identifiers which are separated by the `::`
1693character sequence. The first module identifier in the `modname` name can be the `root`
1694keyword that refers to the root module. The `modname` name can have the `::` prefix.
1695"#;
1696 sig_root_mod.add_var(String::from("usevars"), Sig::BuiltinFun(vec![
1697 BuiltinFunArg::Arg(String::from("modname"))
1698 ]));
1699 doc_root_mod.add_var(String::from("usevars"), String::from(&doc[1..]));
1700
1701 let doc = r#"
1702Removes the module import with the `ident` identifier from the current module.
1703"#;
1704 sig_root_mod.add_var(String::from("removeusemod"), Sig::BuiltinFun(vec![
1705 BuiltinFunArg::Arg(String::from("ident"))
1706 ]));
1707 doc_root_mod.add_var(String::from("removeusemod"), String::from(&doc[1..]));
1708
1709 let doc = r#"
1710Removes the variable import with the `ident` identifier from the current module.
1711"#;
1712 sig_root_mod.add_var(String::from("removeusevar"), Sig::BuiltinFun(vec![
1713 BuiltinFunArg::Arg(String::from("ident"))
1714 ]));
1715 doc_root_mod.add_var(String::from("removeusevar"), String::from(&doc[1..]));
1716
1717 let doc = r#"
1718Removes the module with the `ident` identifier from the current module.
1719"#;
1720 sig_root_mod.add_var(String::from("removemod"), Sig::BuiltinFun(vec![
1721 BuiltinFunArg::Arg(String::from("ident"))
1722 ]));
1723 doc_root_mod.add_var(String::from("removemod"), String::from(&doc[1..]));
1724
1725 let doc = r#"
1726Removes the variable with the `ident` identifier from the current module.
1727"#;
1728 sig_root_mod.add_var(String::from("removevar"), Sig::BuiltinFun(vec![
1729 BuiltinFunArg::Arg(String::from("ident"))
1730 ]));
1731 doc_root_mod.add_var(String::from("removevar"), String::from(&doc[1..]));
1732
1733 let doc = r#"
1734Removes the local variable with the `ident` identifier.
1735"#;
1736 sig_root_mod.add_var(String::from("removelocalvar"), Sig::BuiltinFun(vec![
1737 BuiltinFunArg::Arg(String::from("ident"))
1738 ]));
1739 doc_root_mod.add_var(String::from("removelocalvar"), String::from(&doc[1..]));
1740
1741 let doc = r#"
1742An interruption error occurs if an interruption is occurred.
1743"#;
1744 sig_root_mod.add_var(String::from("checkintr"), Sig::BuiltinFun(vec![]));
1745 doc_root_mod.add_var(String::from("checkintr"), String::from(&doc[1..]));
1746
1747 let doc = r#"
1748Returns the backend name as a string.
1749"#;
1750 sig_root_mod.add_var(String::from("backend"), Sig::BuiltinFun(vec![]));
1751 doc_root_mod.add_var(String::from("backend"), String::from(&doc[1..]));
1752
1753 let doc = r#"
1754Returns the Unlab-gpu version.
1755"#;
1756 sig_root_mod.add_var(String::from("version"), Sig::BuiltinFun(vec![]));
1757 doc_root_mod.add_var(String::from("version"), String::from(&doc[1..]));
1758
1759 let doc = r#"
1760An version error if the Unlab-gpu version isn't matched to the `s` version requirement.
1761"#;
1762 sig_root_mod.add_var(String::from("reqver"), Sig::BuiltinFun(vec![
1763 BuiltinFunArg::Arg(String::from("s"))
1764 ]));
1765 doc_root_mod.add_var(String::from("reqver"), String::from(&doc[1..]));
1766
1767 let doc = r#"
1768Returns the documentation paths as the string.
1769"#;
1770 sig_root_mod.add_var(String::from("docpath"), Sig::BuiltinFun(vec![]));
1771 doc_root_mod.add_var(String::from("docpath"), String::from(&doc[1..]));
1772
1773 let doc = r#"
1774Opens the documentation.
1775
1776If the `libname` library name isn't passed, this function opens this documentation. The `libname`
1777library name should contain the domain and the name which are separeted by the `/` character.
1778"#;
1779 sig_root_mod.add_var(String::from("doc"), Sig::BuiltinFun(vec![
1780 BuiltinFunArg::OptArg(String::from("libname"))
1781 ]));
1782 doc_root_mod.add_var(String::from("doc"), String::from(&doc[1..]));
1783
1784 let doc = r#"
1785This function is alias to the [`doc`](#var.doc) function.
1786"#;
1787 sig_root_mod.add_var(String::from("help"), Sig::BuiltinFun(vec![
1788 BuiltinFunArg::OptArg(String::from("libname"))
1789 ]));
1790 doc_root_mod.add_var(String::from("help"), String::from(&doc[1..]));
1791
1792 let doc = r#"
1793Asserts that the `V` value is `true`.
1794
1795An assertion error occurs if the `V` value isn't `true`. If next arguments are passed, an
1796assertion error has the message that is the formatted next arguments.
1797"#;
1798 sig_root_mod.add_var(String::from("assert"), Sig::BuiltinFun(vec![
1799 BuiltinFunArg::Arg(String::from("V")),
1800 BuiltinFunArg::OptArg(String::from("X")),
1801 BuiltinFunArg::DotDotDot
1802 ]));
1803 doc_root_mod.add_var(String::from("assert"), String::from(&doc[1..]));
1804
1805 let doc = r#"
1806Asserts that the `L` value is equal to the `R` value.
1807
1808An assertion error occurs if the `L` value isn't equal to the `R` value. If next arguments are
1809passed, an assertion error has the message that is the formatted next arguments.
1810"#;
1811 sig_root_mod.add_var(String::from("asserteq"), Sig::BuiltinFun(vec![
1812 BuiltinFunArg::Arg(String::from("L")),
1813 BuiltinFunArg::Arg(String::from("R")),
1814 BuiltinFunArg::OptArg(String::from("X")),
1815 BuiltinFunArg::DotDotDot
1816 ]));
1817 doc_root_mod.add_var(String::from("asserteq"), String::from(&doc[1..]));
1818
1819 let doc = r#"
1820Asserts that the `L` value isn't equal to the `R` value.
1821
1822An assertion error occurs if the `L` value is equal to the `R` value. If next arguments are
1823passed, an assertion error has the message that is the formatted next arguments.
1824"#;
1825 sig_root_mod.add_var(String::from("assertne"), Sig::BuiltinFun(vec![
1826 BuiltinFunArg::Arg(String::from("L")),
1827 BuiltinFunArg::Arg(String::from("R")),
1828 BuiltinFunArg::OptArg(String::from("X")),
1829 BuiltinFunArg::DotDotDot
1830 ]));
1831 doc_root_mod.add_var(String::from("assertne"), String::from(&doc[1..]));
1832
1833 let doc = r#"
1834Asserts that the difference between the `L` value and the `R` value is greater than the `eps`
1835value.
1836
1837An assertion error occurs if the difference between the `L` value and the `R` value isn't greater
1838than the `eps` value. If next arguments are passed, an assertion error has the message that is
1839the formatted next arguments. The differences are recursively checked like comparison without
1840types for matrix arrays, matrix row slices, arrays, or structures. The difference between two
1841elements or two fields are checked if two elements or two fields are numbers, otherwise this
1842function compares two element or two fields.
1843"#;
1844 sig_root_mod.add_var(String::from("assertnearlyeq"), Sig::BuiltinFun(vec![
1845 BuiltinFunArg::Arg(String::from("L")),
1846 BuiltinFunArg::Arg(String::from("R")),
1847 BuiltinFunArg::Arg(String::from("eps")),
1848 BuiltinFunArg::OptArg(String::from("X")),
1849 BuiltinFunArg::DotDotDot
1850 ]));
1851 doc_root_mod.add_var(String::from("assertnearlyeq"), String::from(&doc[1..]));
1852
1853 let doc = r#"
1854Asserts that the difference between the `L` value and the `R` value isn't greater than the `eps`
1855value.
1856
1857An assertion error occurs if the difference between the `L` value and the `R` value is greater
1858than the `eps` value. If next arguments are passed, an assertion error has the message that is
1859the formatted next arguments. The differences are recursively checked like comparison without
1860types for matrix arrays, matrix row slices, arrays, or structures. The difference between two
1861elements or two fields are checked if two elements or two fields are numbers, otherwise this
1862function compares two element or two fields.
1863"#;
1864 sig_root_mod.add_var(String::from("assertnearlyne"), Sig::BuiltinFun(vec![
1865 BuiltinFunArg::Arg(String::from("L")),
1866 BuiltinFunArg::Arg(String::from("R")),
1867 BuiltinFunArg::Arg(String::from("eps")),
1868 BuiltinFunArg::OptArg(String::from("X")),
1869 BuiltinFunArg::DotDotDot
1870 ]));
1871 doc_root_mod.add_var(String::from("assertnearlyne"), String::from(&doc[1..]));
1872
1873 let doc = r#"
1874Adds the current module to the test suites.
1875"#;
1876 sig_root_mod.add_var(String::from("tests"), Sig::BuiltinFun(vec![]));
1877 doc_root_mod.add_var(String::from("tests"), String::from(&doc[1..]));
1878
1879 add_getopts_doc(sig_root_mod, doc_root_mod);
1880 #[cfg(feature = "plot")]
1881 add_plot_doc(sig_root_mod, doc_root_mod);
1882}