eval, Environments and the Process Context

Load: (load "file.scm") from (scheme load) evaluates a file in an environment.

eval is rarely needed in application code; macros and higher-order procedures usually do the job better.

(import (scheme eval) (scheme repl) (scheme process-context) (scheme time))

(eval '(+ 1 2) (environment '(scheme base)))          ; 3
(eval '(* 2 3) (interaction-environment))             ; the REPL's environment
(define expr (list '* 6 7))
(eval expr (environment '(scheme base)))              ; 42

(command-line)                    ; ("prog.scm" "arg1" "arg2")
(get-environment-variable "HOME") ; "/home/ana" or #f
(get-environment-variables)       ; alist of all variables
(exit 0)                          ; exit with a status (runs outstanding dynamic-wind afters)
(emergency-exit 1)                ; exit immediately

(current-second)                  ; seconds since the epoch (inexact)
(current-jiffy)                   ; high-resolution counter
(jiffies-per-second)