22 System
Module System contains some useful features for interacting with the host environment.
SOURCE NOTE: most of these come from r7rs.
Applicative
get-current-second
returns the number of seconds elapsed since the UNIX/POSIX epoch (that is midnight January 1st, 1970, UTC).NOTE: r7rs specifies TAI seconds, but for now we are sticking to POSIX here.
Applicative
get-current-jiffies
returns the number of jiffies (fractions of a second) elapsed since an arbitrary epoch that may change in each run of the klisp interpreter. Applicativeget-jiffies-per-second
can be used to determine which fraction of a second a jiffy represents.
Applicative
get-jiffies-per-second
returns a constant representing the number of jiffies that correspond to one second.
Predicate
file-exists?
checks to see if a file namedstring
exists.
string
should be the name/path for an existing file.Applicative
delete-file
deletes the file namedstring
. If it doesn’t exists or can’t be deleted, an error is signaled. The result returned bydelete-file
is inert.
string1
should be the name/path for an existing file,string2
should be the name/path for a non existing file.Applicative
rename-file
renames the file namedstring1
tostring2
. If the file doesn’t exists or can’t be renamed for any reason, an error is signaled. The result returned byrename-file
is inert.SOURCE NOTE: this is missing from r7rs, it is taken from C, being quite similar to
delete-file
.
— Applicative: get-interpreter-arguments (get-interpreter-arguments)
These applicatives return respectively the script and interpreter arguments. The script arguments are a list of the arguments passed to the klisp interpreter starting from (and including) the script name. The interpreter arguments are the complete list of arguments passed to the klisp interpreter (including the name of the interpreter as the first item in the list, the interpreter flag arguments and the script name and arguments.
Predicate
defined-environment-variable?
returns true iffstring
represents a defined envrionment variable.