private function size(l : list('a)) : int = size'(l, 0)
private function size'(l : list('a), x : int) : int =
switch(l)
[] => x
_ :: l' => size'(l', x + 1)
whats happening here???
private function size(l : list('a)) : int = size'(l, 0)
private function size'(l : list('a), x : int) : int =
switch(l)
[] => x
_ :: l' => size'(l', x + 1)
whats happening here???
What exactly is the question? You loop through the list and count.