diff options
| author | Chouser <chouser@n01se.net> | 2015-01-28 08:24:52 -0500 |
|---|---|---|
| committer | Chouser <chouser@n01se.net> | 2015-01-30 12:54:43 -0500 |
| commit | cc916d9d819d17cc47d34321440bf5a2683eac2e (patch) | |
| tree | ef8be520ffe3422d736487a69be3c56566ce487d /ocaml/printer.ml | |
| parent | 44d4e31fc8387a52918992ed40bd4b20d7646f39 (diff) | |
| download | mal-cc916d9d819d17cc47d34321440bf5a2683eac2e.tar.gz mal-cc916d9d819d17cc47d34321440bf5a2683eac2e.zip | |
Ocaml: Use builtin String.concat instead of own join fun
Diffstat (limited to 'ocaml/printer.ml')
| -rw-r--r-- | ocaml/printer.ml | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/ocaml/printer.ml b/ocaml/printer.ml index d63e5f0..8e71376 100644 --- a/ocaml/printer.ml +++ b/ocaml/printer.ml @@ -1,8 +1,5 @@ module T = Types.Types -let join sep xs = - List.fold_left (fun a x -> if a = "" then x else a ^ sep ^ x) "" xs - let meta obj = match obj with | T.List { T.meta = meta } -> meta @@ -25,9 +22,9 @@ let rec pr_str mal_obj print_readably = then "\"" ^ (Str.global_replace (Str.regexp "\\([\"\\]\\)") "\\\\\\1" s) ^ "\"" else s | T.List { T.value = xs } -> - "(" ^ (join " " (List.map (fun s -> pr_str s r) xs)) ^ ")" + "(" ^ (String.concat " " (List.map (fun s -> pr_str s r) xs)) ^ ")" | T.Vector { T.value = xs } -> - "[" ^ (join " " (List.map (fun s -> pr_str s r) xs)) ^ "]" + "[" ^ (String.concat " " (List.map (fun s -> pr_str s r) xs)) ^ "]" | T.Map { T.value = xs } -> (Types.MalMap.fold (fun k v s -> s ^ (if s = "" then "{" else ", ") ^ (pr_str k r) ^ " " ^ (pr_str v r)) xs "") |
