February 2019
Beginner to intermediate
180 pages
4h 4m
English
Since list is a recursive data structure, we typically use recursion when working with it.
To get warmed up, let's write a (naive) function that sums a list of integers:
let rec sum = list => switch(list) { | [] => 0 | [hd, ...tl] => hd + sum(tl)};
Passing sum the list [1, 2, 3] results in ...
Read now
Unlock full access