Commit 51b482c7 authored by Taddeus Kroes's avatar Taddeus Kroes

funclang series3: Added comments for 'nth' fucntion.

parent 51238e10
......@@ -2,7 +2,8 @@ open List
(* 1 *)
let rec nth l n =
(* *)
(* Walk through the list recursively, subtracting 1 off n each time and
* matching it with 0 to check of the nth element has been reached yet *)
match n with
| 0 -> hd l
| i when i > 0 && i < (length l) -> nth (tl l) (i - 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment