]> git.lizzy.rs Git - uwu-lang.git/blob - doc/std.md
Add :nil:nil
[uwu-lang.git] / doc / std.md
1 # Standard library
2
3 ## The `:nil` module
4
5 - `:nil:nil`: The nil constant
6
7 ## The `:bool` module
8
9 - `: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 truey.
10
11 - `: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.
12
13 - `: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.
14
15 - `: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.
16
17 - `: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.
18
19 - `:bool:true`: The true constant
20
21 - `:bool:false`: The false constant
22
23 - `: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).
24
25 ## The `:int` module
26
27 - `: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.
28
29 - `:int:sub`: Accepts exactly 2 integer arguments and returns their difference.
30
31 - `: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.
32
33 - `:int:div`: Accepts exactly 2 integer arguments and returns their quotient (rounded towards 0).
34
35 - `:int:mod`: Accepts exactly 2 integer arguments and returns the reminder of their division.
36
37 - `:int:smaller`: Accepts exactly 2 integer arguments and returns `:bool:true` if $0 is smaller than $1, `:boool:false` else.
38
39 - `:int:greater`: Accepts exactly 2 integer arguments and returns `:bool:true` if $0 is greater than $1, `:bool:false` else.
40
41 - `:int:equal`: Accepts an arbitrary number of integer arguments, but at least 2. Returns `bool:true` if all the arguments are equal.
42
43 - `:int:is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `:bool:true` if all arguments are integers.
44
45 ## The `:str` module
46
47 - `:str:cat`: Accepts an arbitrary number of arguments of arbitrary type and returns the concatenation of their string representations.
48
49 ### String representations
50
51 - Integers: decimal notation
52 - Strings: themself
53 - Function references: `[Function referece: %p]`, where %p is the memory address of the UwUVMFunction in memory.
54 - Nil: an empty string
55 - Booleans: `true` or `false`