System interface

(load filename ) load library procedure
(load filename environment-specifier ) load library procedure
It is an error if filename is not a string.

An implementation-dependent operation is used to transform filename into the name of an existing file containing Scheme source code. The load procedure reads expressions and definitions from the file and evaluates them sequentially in the environment specified by environment-specifier. If environment-specifier is omitted, (interaction-environment) is assumed.

It is unspecified whether the results of the expressions are printed. The load procedure does not affect the values returned by current-input-port and current-output-port. It returns an unspecified value.

Rationale: For portability, load must operate on source files. Its operation on other kinds of files necessarily varies among implementations.

(file-exists? filename ) file library procedure
It is an error if filename is not a string.

The file-exists? procedure returns #t if the named file exists at the time the procedure is called, and #f otherwise.

(delete-file filename ) file library procedure
It is an error if filename is not a string.

The delete-file procedure deletes the named file if it exists and can be deleted, and returns an unspecified value. If the file does not exist or cannot be deleted, an error that satisfies file-error? is signaled.

(exit) process-context library procedure
(exit obj ) process-context library procedure
Runs all outstanding dynamic-wind after procedures, terminates the running program, and communicates an exit value to the operating system. If no argument is supplied, or if obj is #t, the exit procedure communicates to the operating system that the program exited normally. If obj is #f, the exit procedure communicates to the operating system that the program exited abnormally.

The exit procedure must not signal an exception or return to its continuation.

Note: Because of the requirement to run handlers, this procedure is not just the operating system's exit procedure.

(emergency-exit) process-context library procedure
(emergency-exit obj ) process-context library procedure
Terminates the program without running any outstanding dynamic-wind after procedures and communicates an exit value to the operating system in the same manner as exit.

(exit-success) process-context library procedure
Terminates the program without running any outstanding dynamic-wind after procedures and communicates a successful exit value to the operating system in the same manner as exit.

(exit-fail) process-context library procedure
Terminates the program without running any outstanding dynamic-wind after procedures and communicates a failure exit value to the operating system in the same manner as exit.

(get-environment-variable name ) process-context library procedure
Many operating systems provide each running process with an environment consisting of environment variables. (This environment is not to be confused with the Scheme environments that can be passed to eval: see section 6.12.) Both the name and value of an environment variable are strings. The procedure get-environment-variable returns the value of the environment variable name, or #f if the named environment variable is not found. It may use locale information to encode the name and decode the value of the environment variable. It is an error if
get-environment-variable can't decode the value. It is also an error to mutate the resulting string.

(get-environment-variable "PATH") ==> "/usr/local/bin:/usr/bin:/bin"

(get-environment-variables) process-context library procedure
Returns the names and values of all the environment variables as an alist, where the car of each entry is the name of an environment variable and the cdr is its value, both as strings. The order of the list is unspecified. It is an error to mutate any of these strings or the alist itself.

(current-second) time library procedure
Returns an inexact number representing the current time on the International Atomic Time (TAI) scale. The value 0.0 represents midnight on January 1, 1970 TAI (equivalent to ten seconds before midnight Universal Time) and the value 1.0 represents one TAI second later. Neither high accuracy nor high precision are required; in particular, returning Coordinated Universal Time plus a suitable constant might be the best an implementation can do.

(current-jiffy) time library procedure
Returns the number of jiffies as an exact integer that have elapsed since an arbitrary, implementation-defined epoch. A jiffy is an implementation-defined fraction of a second which is defined by the return value of the jiffies-per-second procedure. The starting epoch is guaranteed to be constant during a run of the program, but may vary between runs.

(jiffies-per-second) time library procedure
Returns an exact integer representing the number of jiffies per SI second. This value is an implementation-specified constant.

(define (time-length) (let ((list (make-list 100000)) (start (current-jiffy))) (length list) (/ (- (current-jiffy) start) (jiffies-per-second))))

(features) procedure
Returns a list of the feature identifiers which cond-expand treats as true. It is an error to modify this list.

(system command ) process-context library procedure
It is an error if command is not a string.

Executes the given operating system command, displays the results to standard output, and returns the OS return code from the command.

husk-scheme online documentation rev 3.2 (2021.03.04)