F# on Mac: Syntax Error on Inner Function
- by JBristow
The following code:
exception NoElements of string
let nth(k, list) =
let rec loop count list =
match list with
| head :: _ when count = k -> head
| _ :: tail when count <> k -> loop (count+1) tail
| [] -> raise (NoElements("No Elements"))
loop 0 list
;;
printfn "%A" (nth(2, [1, 1, 2, 3, 5,…