let rmindex l i = 
 let rec rmindex acc = function
  | (0,x::xs) -> List.append (List.rev acc) xs
  | (i,x::xs) -> rmindex (x::acc) (i-1,xs)    
  | (_,[])    -> failwith "rmindex: index out of bounds" in
 rmindex [] (i,l)