Skip to content

Commit f051d1e

Browse files
committed
fix namespace for getenv and nanoTime and sleep
1 parent cf7ecf1 commit f051d1e

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

src/clojure/core.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
(- x 1))
4141

4242
(defmacro time [expr]
43-
(list (quote let) [(quote start) (quote (System_nanoTime)) (quote ret) expr]
43+
(list (quote let) [(quote start) (quote (System/nanoTime)) (quote ret) expr]
4444
(quote (do
45-
(println (str "Elapsed time: " (_slash_ (- (System_nanoTime) start) 1000000.0) " msecs"))
45+
(println (str "Elapsed time: " (_slash_ (- (System/nanoTime) start) 1000000.0) " msecs"))
4646
ret))))
4747

4848
(defn slurp [f & opts]

src/environment.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,24 @@ impl Environment {
244244
environment.insert(Symbol::intern("defmacro"), defmacro_macro.to_rc_value());
245245
environment.insert(Symbol::intern("eval"), eval_fn.to_rc_value());
246246

247-
// Thread namespace TODO / instead of _
248-
environment.insert(
249-
Symbol::intern("Thread_sleep"),
250-
thread_sleep_fn.to_rc_value(),
251-
);
252-
253-
environment.insert(Symbol::intern("System_nanoTime"), nanotime_fn.to_rc_value());
254-
255-
environment.insert(Symbol::intern("System_getenv"), get_env_fn.to_rc_value());
247+
// Thread namespace
248+
environment.insert_into_namespace(
249+
&Symbol::intern("Thread"),
250+
Symbol::intern("sleep"),
251+
thread_sleep_fn.to_rc_value()
252+
);
253+
254+
// System namespace
255+
environment.insert_into_namespace(
256+
&Symbol::intern("System"),
257+
Symbol::intern("nanoTime"),
258+
nanotime_fn.to_rc_value()
259+
);
260+
environment.insert_into_namespace(
261+
&Symbol::intern("System"),
262+
Symbol::intern("getenv"),
263+
get_env_fn.to_rc_value()
264+
);
256265

257266
// core.clj wraps calls to the rust implementations
258267
// @TODO add this to clojure.rs.core namespace as clojure.rs.core/slurp

0 commit comments

Comments
 (0)