Question d’entretien chez Jane Street

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

Réponses aux questions d'entretien

Utilisateur anonyme

6 avr. 2012

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

3

Utilisateur anonyme

3 févr. 2015

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