Press CTRL+C or CMD+C to copy the selected text and close this dialog.
Tweet
0 people like it. Like the snippet!
f# has Seq.length but we ask that you reimplement it. Bonus for a tail recursive solution.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10:
let length l = let rec length' c = function | h :: t -> length' (c + 1) t | [] -> 0 length' 0 l length [ "a" ; "b" ; "c" ; "d" ] length [ "a" ; "b" ; "c" ; "d" ] length [ "a" ] length ([ ] : int list)