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