Login
From:
The Blag — Logic And Graphics
(Uncensored)
subscribe
Tail-recursive map in OCaml
https://blag.cedeela.fr/tail-recursive-map-in-ocaml/
links
backlinks
Roast topics
Find topics
Find it!
The List.map function of the OCaml standard lib is not implemented tail-recursively. The current version (as of 4.00 on my computer) is let rec map f = function [] -> [] | a::l -> let r = f a in r :: map f l