:: operator in OCaml is used to create head tail lists.
[1; 2; 3;]
Can also be written as:
1 :: (2 :: (3 :: ))
And in fact, the AST of the first example is a nested data structure joined with the
You can read more about lists here
The first way is convenient, but the second way is important because lists are pattern matched with the
let pat_match_func numbers = match numbers with | first_number :: rest_of_numbers -> # do something with first number