let rec take count l = match count, l with | 0, xs -> [] | n, x::xs -> x::take (n - 1) xs | n, [] -> failwith "Index out of range" let rec skip count l = match count, l with | 0, xs -> xs | n, x::xs -> skip (n - 1) xs | n, [] -> failwith "Index out of range" let rec insert index v l = match index, l with | 0, xs -> v::xs | n, x::xs -> x::insert (n - 1) v xs | n, [] -> failwith "Index out of range" let rec delete index l = match index, l with | 0, x::xs -> xs | n, x::xs -> x::delete (n - 1) xs | n, [] -> failwith "Index out of range"