add illustration samples

This commit is contained in:
Oli Sturm
2022-07-22 15:00:53 +01:00
parent 0a28574514
commit 250d86bafa
5 changed files with 58 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
// In F# the keywoard `match` can be used to run an
// explicit pattern match.
let rec listLength l =
match l with
| [] -> 0
| _ :: xs -> 1 + (listLength xs)
// Alternatively, this special syntax is available
// that removes the explicit parameter and the
// `match` call.
let rec listLength' = function
| [] -> 0
| _ :: xs -> 1 + (listLength' xs)