You can do this with a simple recursion :
let rec print_list = function [] -> () | e::l -> print_int e ; print_string " " ; print_list l
The head of the list is printed, then you do a recursive call on the tail of the list.
You can do this with a simple recursion :
let rec print_list = function [] -> () | e::l -> print_int e ; print_string " " ; print_list l
The head of the list is printed, then you do a recursive call on the tail of the list.