You are viewing a single comment's thread. Return to all comments →
let rec read_lines acc = try let line = input_line stdin in read_lines (acc @ [line]) with End_of_file -> acc;; let arr = read_lines [];; let rec rev = function | [] -> [] | h::t -> (rev t)@[h];; let () = List.iter print_endline (rev arr);;
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse a List
You are viewing a single comment's thread. Return to all comments →
OCaml solution