Previous: Input and output, Up: Standard procedures [Index]
Questions of system interface generally fall outside of the domain of this report. However, the following operations are important enough to deserve description here.
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.
For portability, load
must operate on source files.
Its operation on other kinds of files necessarily varies among
implementations.
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.
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.
Returns the command line passed to the process as a list of strings. The first string corresponds to the command name, and is implementation-dependent. It is an error to mutate any of these strings.
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 should communicate to the operating system
that the program exited normally. If obj is #f
, the
exit
procedure should communicate to the operating system
that the program exited abnormally. Otherwise, exit
should
translate obj into an appropriate exit value for the operating
system, if possible.
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.
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
.
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 Environments and evaluation.)
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"
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.
(get-environment-variables) ⇒ (("USER" . "root") ("HOME" . "/"))
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 8.000082 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.
As of 2018, a TAI-UTC offset table can be found at [TAI].
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 are allowed to be implementation-dependent so that
current-jiffy
can execute with minimum overhead. It should be
very likely that a compactly represented integer will suffice as the
returned value. Any particular jiffy size will be inappropriate for
some implementations: a microsecond is too long for a very fast
machine, while a much smaller unit would force many implementations to
return integers which have to be allocated for most calls, rendering
current-jiffy
less useful for accurate timing measurements.
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))))
Returns a list of the feature identifiers which cond-expand treats as
true. It is an error to modify this list. Here is an example of what
features
might return:
(features) ⇒ (r7rs ratios exact-complex full-unicode gnu-linux little-endian fantastic-scheme fantastic-scheme-1.0 space-ship-control-system)
Previous: Input and output, Up: Standard procedures [Index]