commit c52cdb298fd056ad696e14ec98a4c6a268bee8f5 parent 53b0113ccfd5c500c6bd79df2f6ecd6aa209383f Author: Andrew Laack <andrew@laack.co> Date: Sun, 6 Sep 2026 11:20:00 -0500 Pattern match on list for recursive length calculation Diffstat:
| A | ch3/follow-along/list_length.ml | | | 7 | +++++++ |
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/ch3/follow-along/list_length.ml b/ch3/follow-along/list_length.ml @@ -0,0 +1,7 @@ +let rec ll xs = match xs with + | [] -> 0 + | x :: xs' -> 1 + ll xs' + +let () = + print_int (ll [10;131]); + print_newline ();