>>186 ocaml
https://ideone.com/VpQwAG
let f xs =
let rec g = function
[] -> 0, 1
| a :: [] -> a, 1
| a :: b :: [] -> a + b, 1
| a :: b :: cs -> let n, d = g cs in a * n + b * d, n
in let n, d = g xs in Printf.printf "%d / %d = " n d;float n /. float d

>>186 ocaml
https://ideone.com/5D0lHx
let f xs =
let rec g = function
[] -> 0, 1
| x :: [] -> x, 1
| x :: xs -> let n, d = h xs in x * d + n, d
and h = function
[] -> 0, 1
| x :: [] -> x, 1
| x :: xs -> let n, d = g xs in x * d, n
in let n, d = g xs in Printf.printf "%d / %d = " n d;float n /. float d