diff options
| -rw-r--r-- | ocaml/Makefile | 2 | ||||
| -rw-r--r-- | ocaml/core.ml | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/ocaml/Makefile b/ocaml/Makefile index e5b0ac2..72d159a 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -2,7 +2,7 @@ STEPS = step0_repl.ml step1_read_print.ml step2_eval.ml step3_env.ml \ step4_if_fn_do.ml step5_tco.ml step6_file.ml step7_quote.ml \ step8_macros.ml step9_try.ml stepA_interop.ml MODULES = types.ml reader.ml printer.ml env.ml core.ml -LIBS = str.cmxa +LIBS = str.cmxa unix.cmxa MAL_LIB = mal_lib.cmxa STEP_BINS = $(STEPS:%.ml=%) diff --git a/ocaml/core.ml b/ocaml/core.ml index 6d7b014..20f68b6 100644 --- a/ocaml/core.ml +++ b/ocaml/core.ml @@ -197,4 +197,7 @@ let init env = begin Env.set env (Types.symbol "swap!") (Types.fn (function T.Atom x :: T.Fn { T.value = f } :: args -> let v = f (!x :: args) in x := v; v | _ -> T.Nil)); + + Env.set env (Types.symbol "time-ms") + (Types.fn (function _ -> T.Int (truncate (1000.0 *. Unix.gettimeofday ())))); end |
