Question d’entretien chez Jane Street

Write a function to append two lists in OCaml.

Réponses aux questions d'entretien

Utilisateur anonyme

25 nov. 2012

L1 @ L2

2

Utilisateur anonyme

14 août 2020

let rec append (l1:'a list) (l2:'a list) : 'a list = match l1 with |[] -> l2 |h::t -> h::append t l2

Utilisateur anonyme

14 août 2020

let rec append (l1:'a list) (l2:'a list) : 'a list = match l1 with |[] -> l2 |h::t -> h::append t l2

Utilisateur anonyme

14 août 2020

``` let rec append (l1:'a list) (l2:'a list) : 'a list = match l1 with |[] -> l2 |h::t -> h::append t l2 ```

Utilisateur anonyme

15 août 2012

let rec append_list l1 l2 = match l1 with [] -> l2 | h :: t -> h :: (append_list t l2) Usage: # append_list [1;2;3] [4;5] - : int list = [1;2;3;4;5]

3