aboutsummaryrefslogtreecommitdiff
path: root/ocaml/core.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml/core.ml')
-rw-r--r--ocaml/core.ml14
1 files changed, 14 insertions, 0 deletions
diff --git a/ocaml/core.ml b/ocaml/core.ml
index 4cec7f1..c11c9f9 100644
--- a/ocaml/core.ml
+++ b/ocaml/core.ml
@@ -28,5 +28,19 @@ let init env = begin
Env.set env (Types.Symbol "=")
(Types.Fn (function [a; b] -> Types.Bool (a = b) | _ -> Types.Bool false));
+ Env.set env (Types.Symbol "pr-str")
+ (Types.Fn (function xs ->
+ Types.String (Printer.join " " (List.map (fun s -> Printer.pr_str s true) xs))));
+ Env.set env (Types.Symbol "str")
+ (Types.Fn (function xs ->
+ Types.String (Printer.join "" (List.map (fun s -> Printer.pr_str s false) xs))));
+ Env.set env (Types.Symbol "prn")
+ (Types.Fn (function xs ->
+ print_endline (Printer.join " " (List.map (fun s -> Printer.pr_str s true) xs));
+ Types.Nil));
+ Env.set env (Types.Symbol "println")
+ (Types.Fn (function xs ->
+ print_endline (Printer.join " " (List.map (fun s -> Printer.pr_str s false) xs));
+ Types.Nil));
end