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-secondreturns 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-jiffiesreturns 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-secondcan be used to determine which fraction of a second a jiffy represents.
Applicative
get-jiffies-per-secondreturns a constant representing the number of jiffies that correspond to one second.
Predicate
file-exists?checks to see if a file namedstringexists.
stringshould be the name/path for an existing file.Applicative
delete-filedeletes the file namedstring. If it doesn’t exists or can’t be deleted, an error is signaled. The result returned bydelete-fileis inert.
string1should be the name/path for an existing file,string2should be the name/path for a non existing file.Applicative
rename-filerenames the file namedstring1tostring2. If the file doesn’t exists or can’t be renamed for any reason, an error is signaled. The result returned byrename-fileis 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 iffstringrepresents a defined envrionment variable.