From 4030f96b6ee7dba16848169d377cfd2f5979d992 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sat, 16 Aug 2025 02:08:57 +0300 Subject: doc: added empty vector initialization and int vector sum to TUTORIAL.md --- TUTORIAL.md | 12 +++++++++--- 1 file 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 -- cgit v1.2.3