@@ -70,7 +70,7 @@ use Environment::*;
7070impl Environment {
7171 pub fn change_namespace ( & self , symbol : Symbol ) {
7272 let symbol = symbol. unqualified ( ) ;
73-
73+
7474 match self . get_main_environment ( ) {
7575 MainEnvironment ( EnvironmentVal { curr_ns_sym, ..} ) => {
7676 curr_ns_sym. replace ( symbol) ;
@@ -162,9 +162,9 @@ impl Environment {
162162 match self {
163163 MainEnvironment ( env_val) => {
164164 // If we've recieved a qualified symbol like
165- // clojure.core/+
165+ // clojure.core/+
166166 if sym. ns != "" {
167- // Use that namespace
167+ // Use that namespace
168168 env_val. get_from_namespace ( & Symbol :: intern ( & sym. ns ) , sym)
169169 }
170170 else {
@@ -198,8 +198,9 @@ impl Environment {
198198 let nth_fn = rust_core:: NthFn { } ;
199199 let do_macro = rust_core:: DoMacro { } ;
200200 let concat_fn = rust_core:: ConcatFn { } ;
201+ let flush_stdout_fn = rust_core:: FlushStdoutFn { } ;
202+ let system_newline_fn = rust_core:: SystemNewlineFn { } ;
201203 let print_string_fn = rust_core:: PrintStringFn { } ;
202- let println_string_fn = rust_core:: PrintlnStringFn { } ;
203204 let read_line_fn = rust_core:: ReadLineFn { } ;
204205 let assoc_fn = rust_core:: AssocFn { } ;
205206
@@ -209,6 +210,7 @@ impl Environment {
209210 // clojure.std functions
210211 let thread_sleep_fn = clojure_std:: thread:: SleepFn { } ;
211212 let nanotime_fn = clojure_std:: time:: NanoTimeFn { } ;
213+ let get_env_fn = clojure_std:: env:: GetEnvFn { } ;
212214
213215 // Hardcoded fns
214216 let lexical_eval_fn = Value :: LexicalEvalFn { } ;
@@ -248,10 +250,9 @@ impl Environment {
248250 thread_sleep_fn. to_rc_value ( ) ,
249251 ) ;
250252
251- environment. insert (
252- Symbol :: intern ( "System_nanotime" ) ,
253- nanotime_fn. to_rc_value ( )
254- ) ;
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 ( ) ) ;
255256
256257 // core.clj wraps calls to the rust implementations
257258 // @TODO add this to clojure.rs.core namespace as clojure.rs.core/slurp
@@ -275,13 +276,19 @@ impl Environment {
275276 environment. insert ( Symbol :: intern ( "nth" ) , nth_fn. to_rc_value ( ) ) ;
276277 environment. insert ( Symbol :: intern ( "assoc" ) , assoc_fn. to_rc_value ( ) ) ;
277278 environment. insert ( Symbol :: intern ( "concat" ) , concat_fn. to_rc_value ( ) ) ;
279+
280+ // input and output
278281 environment. insert (
279- Symbol :: intern ( "print-string " ) ,
280- print_string_fn . to_rc_value ( ) ,
282+ Symbol :: intern ( "system-newline " ) ,
283+ system_newline_fn . to_rc_value ( ) ,
281284 ) ;
282285 environment. insert (
283- Symbol :: intern ( "println-string" ) ,
284- println_string_fn. to_rc_value ( ) ,
286+ Symbol :: intern ( "flush-stdout" ) ,
287+ flush_stdout_fn. to_rc_value ( ) ,
288+ ) ;
289+ environment. insert (
290+ Symbol :: intern ( "print-string" ) ,
291+ print_string_fn. to_rc_value ( ) ,
285292 ) ;
286293 environment. insert ( Symbol :: intern ( "read-line" ) , read_line_fn. to_rc_value ( ) ) ;
287294
@@ -330,16 +337,16 @@ mod tests {
330337 // env_val.change_namespace(Symbol::intern_with_ns("not-ns","ns"));
331338 // assert_eq!(Symbol::intern("ns"),env_val.get_current_namespace())
332339 ;
333-
334- // @TODO add case for local environment
340+
341+ // @TODO add case for local environment
335342 }
336-
343+
337344 /////////////////////////////////////////////////////////////////////////////
338345 //
339346 // fn get_from_namespace(&self,namespace: &Symbol,sym: &Symbol) -> Rc<Value>
340347 //
341348 //////////////////////////////////////////////////////////////////////////////
342-
349+
343350 #[ test]
344351 fn test_get_from_namespace ( ) {
345352 let env_val = EnvironmentVal :: new_main_val ( ) ;
0 commit comments