Domanda di colloquio di Jane Street

Write an append function in OCaml. (never used OCaml before)

Risposte di colloquio

Anonimo

6 apr 2012

let rec append lst el = match lst with | [] -> [el] | head :: tail -> head :: append tail el;;

3

Anonimo

3 feb 2015

For a tail recursive answer, let append list el = List.rev(el::List.rev(list))