I'm trying to make this recursive function which takes an int x and a list, and then removes the first x amount of elements from the list:
let rec nthcdr int_t list_t =
match int_t with
| 0 -> list_t
| _ -> (match list_t with
| [] -> []
| h::tail -> nthcdr (int_t -1) tail)
;;
but it does not work, h::tail seems to never match, and it always returns []
nthcdr 3 [1;2;3;4;5]==>int list = [4; 5]. - Jeffrey Scofieldhd::tlinstead ofh::tailordrop n liinstead of whatever the function's name means) before posting or just for your own sanity. - Pie 'Oh' Pah