aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2025-08-16 02:08:57 +0300
committerJoel Kronqvist <joel.kronqvist@iki.fi>2025-08-16 02:08:57 +0300
commit4030f96b6ee7dba16848169d377cfd2f5979d992 (patch)
treea889cc186bd2f4b3e30909049e9cd87937315334
parentbbbe6a4718deedb8ff19d6be15470e9af8a33e1c (diff)
downloadmyslip-4030f96b6ee7dba16848169d377cfd2f5979d992.tar.gz
myslip-4030f96b6ee7dba16848169d377cfd2f5979d992.zip
doc: added empty vector initialization and int vector sum to TUTORIAL.md
-rw-r--r--TUTORIAL.md12
1 files changed, 9 insertions, 3 deletions
diff --git a/TUTORIAL.md b/TUTORIAL.md
index 4cf8948..c8eaab2 100644
--- a/TUTORIAL.md
+++ b/TUTORIAL.md
@@ -191,8 +191,6 @@ The elements of a list can of course be of different types:
(quote - 0 (quote 1 2)) : (Quote ((Int Int) -> Int) Int (Quote (Int Int)))
```
-TODO: List destructuring
-
Vectors
-------
@@ -207,7 +205,15 @@ vector : ((T ...) -> (Vector (T ...)))
(vector 1 2 3 4) : (Vector (Int ...))
```
-TODO: vector destructuring
+An empty vector is created by passing its type to nil:
+```console
+> (() Int)
+vector : (Int ...)
+```
+
+The standard library provides the function `sum` to
+calculate the sum of a vector of integers. Through
+type conversions, this works for lists too.
Pattern matching