RosettaCodeData/Task/Singly-linked-list-Element-insertion/OCaml/singly-linked-list-element-insertion.ml

5 lines
165 B
OCaml
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
let rec insert_after a b = function
c :: cs when a = c -> a :: b :: cs
| c :: cs -> c :: insert_after a b cs
| [] -> raise Not_found