let join = fun ?(sep = " ") ~to_string list ->
let result = ref "" and first = ref true in
let rec join = function
| [] -> ()
| hd :: tl ->
join tl;
if !first
then first := false
else result := sep ^ !result;
result := (to_string hd) ^ !result
in
join list; !result