Files
Oli Sturm c9c1b53630 fixes
2025-05-08 14:17:31 +01:00

16 lines
374 B
FSharp

// In F# the keyword `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)