Close #18. My hesitation is whether the complex code to make it tail-recursive is worth it:
let concat bs =
let[@tail_mod_cons] rec go bs =
function
| Emp ->
begin
match bs with
| Emp -> Emp
| Snoc (bs, b) -> (go[@tailcall]) bs b
end
| Snoc (xs, x) ->
Snoc ((go[@tailcall]) bs xs, x)
in
go bs Emp
Close #18. My hesitation is whether the complex code to make it tail-recursive is worth it: