Skip to content
Snippets Groups Projects
Commit 51b482c7 authored by Taddeus Kroes's avatar Taddeus Kroes
Browse files

funclang series3: Added comments for 'nth' fucntion.

parent 51238e10
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment