]> git.lizzy.rs Git - uwu-lang.git/blob - doc/std.md
Update capitalization of Turing in the README (#1)
[uwu-lang.git] / doc / std.md
1 # Standard library
2
3 ## The `bool` module
4
5 - `bool.if`: Requires exactly 3 arguments of arbitrary type. If $0 is a truthy value, evaluate and return $1. If $0 is a falsy value, evaluate and return $2. Values considered as falsy are: `bool.false` and `nil.nil`. Everything else is considered truthy.
6 - `bool.and`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if all of the arguments are considered truthy.
7 - `bool.or`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if at least one of the arguments is considered truthy.
8 - `bool.equal`: Accepts an arbitrary number of arguments of arbitrary type, but at least 2. Returns `bool.true` if either all of the arguments are considered truthy or all of the arguments are considered falsy.
9 - `bool.not`: Accepts exactly one argument of arbitrary type. Returns `bool.true` if the $0 is considered falsy, returns `bool.false` if $0 is considered truthy.
10 - `bool.true`: The true constant
11 - `bool.false`: The false constant
12 - `bool.is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if all arguments are booleans (`nil.nil` is NOT considered a boolean).
13
14 ## The `:int` module
15
16 - `int.add`: Accepts an arbitrary number of integer arguments (or none at all) and returns the sum of all arguments, or `0` if none were given.
17 - `int.sub`: Accepts exactly 2 integer arguments and returns their difference.
18 - `int.mul`: Accepts an arbitrary number of integer arguments (or none at all) and returns the product of all arguments, or `1` if none were given.
19 - `int.div`: Accepts exactly 2 integer arguments and returns their quotient (rounded towards 0).
20 - `int.mod`: Accepts exactly 2 integer arguments and returns the reminder of their division.
21 - `int.smaller`: Accepts exactly 2 integer arguments and returns `bool.true` if $0 is smaller than $1, `bool.false` else.
22 - `int.greater`: Accepts exactly 2 integer arguments and returns `bool.true` if $0 is greater than $1, `bool.false` else.
23 - `int.equal`: Accepts an arbitrary number of integer arguments, but at least 2. Returns `bool.true` if all the arguments are equal.
24 - `int.is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if all arguments are integers.
25
26 ## The `nil` module
27
28 - `nil.nil`: The nil constant
29 - `nil.is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if all arguments are strings.
30
31 ## The `ref` module
32
33 - `ref.call`: Accepts a function reference as $0 and after that and arbitrary number of arguments of arbitrary type. Calls the function $0 with the arguments that follow and returns it's return value.
34 - `ref.is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if all arguments are function references.
35
36 ## The `str` module
37
38 - `str.cat`: Accepts an arbitrary number of arguments of arbitrary type and returns the concatenation of their string representations.
39 - `str.is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if all arguments are strings.
40
41 ### String representations
42
43 - Integers: decimal notation
44 - Strings: themself
45 - Function references: `[Function referece: %p]`, where %p is the memory address of the UwUVMFunction in memory.
46 - Nil: an empty string
47 - Booleans: `true` or `false`