aboutsummaryrefslogtreecommitdiff
path: root/doc/std.md
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2021-12-30 15:15:17 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2021-12-30 15:15:17 +0100
commit1cdeea8bd4be4dd55f4ab5d5d0c33586473e0cb1 (patch)
treeb6192300a54d7deed33164a9830ae077372677c9 /doc/std.md
parent09d398c748c2707918c9f531b91d161b08cb1163 (diff)
downloaduwu-lang-1cdeea8bd4be4dd55f4ab5d5d0c33586473e0cb1.tar.xz
Extend documentation
Diffstat (limited to 'doc/std.md')
-rw-r--r--doc/std.md51
1 files changed, 51 insertions, 0 deletions
diff --git a/doc/std.md b/doc/std.md
new file mode 100644
index 0000000..1ebd6db
--- /dev/null
+++ b/doc/std.md
@@ -0,0 +1,51 @@
+# Standard library
+
+## The `:bool` module
+
+- `: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.
+
+- `: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.
+
+- `: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.
+
+- `: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.
+
+- `: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.
+
+- `:bool:true`: The true constant
+
+- `:bool:false`: The false constant
+
+- `: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).
+
+## The `:int` module
+
+- `: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.
+
+- `:int:sub`: Accepts exactly 2 integer arguments and returns their difference.
+
+- `: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.
+
+- `:int:div`: Accepts exactly 2 integer arguments and returns their quotient (rounded towards 0).
+
+- `:int:mod`: Accepts exactly 2 integer arguments and returns the reminder of their division.
+
+- `:int:smaller`: Accepts exactly 2 integer arguments and returns `:bool:true` if $0 is smaller than $1, `:boool:false` else.
+
+- `:int:greater`: Accepts exactly 2 integer arguments and returns `:bool:true` if $0 is greater than $1, `:bool:false` else.
+
+- `:int:equal`: Accepts an arbitrary number of integer arguments, but at least 2. Returns `bool:true` if all the arguments are equal.
+
+- `:int:is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `:bool:true` if all arguments are integers.
+
+## The `:str` module
+
+- `:str:cat`: Accepts an arbitrary number of arguments of arbitrary type and returns the concatenation of their string representations.
+
+### String representations
+
+- Integers: decimal notation
+- Strings: themself
+- Function references: `[Function referece: %p]`, where %p is the memory address of the UwUVMFunction in memory.
+- Nil: an empty string
+- Booleans: `true` or `false`