SIOD: Scheme In One Defune, Reference Appendix
Not all of the functions in this appendix have been implemented in Gimp. This is the complete list of SIOD functions for your reference.

## Reference Section For Built-in Procedures
| Note that the arguments to built-in procedures are always optional and default to ( ). Many of these procedures call a C library function of the same or similar name, in the obvious way. Therefore, you can refer to the UNIX manual page for more detailed information about function behavior. Such procedures are indicated with a bold U. (%%%memref address) This is a low level routine which should not be invoked in normal code. References a byte of memory at address. Used mostly to cause a core dump for debugging purposes by referencing address 0 or -1. (%%closure env code) This is a low-level routine which should not be invoked in normal code. If code is a cons of the form (arlist . body), then env is a list of frames, and the application of the closure will invoke the interpreter. Otherwise, code should be of type tc_subr_X and the application of the closure will pass the env as the first argument to the C procedure implementing the subr. (%%closure-code closure) This is a low-level routine which should not be invoked in normal code. Returns the code passed to %%closure. (%%closure-env closure) This is a low-level routine which should not be invoked in normal code. Returns the env passed to %%closure. (%%stack-limit amount silent) If amount is non-null, it sets the runtime stack check pointer to allow for that number of bytes. If silent is non-null, the resulting (or current) stack size is returned; otherwise, a message is printed. (* x1 x2 ...) Returns the product of all its arguments, or 1 if no arguments. *after-gc* A variable, the value is an express evaluated after the gc has done its work. For example: (set! *after-gc* '(if (< (gc-info 4) 5000) (allocate-heap))) *args* A variable, bound to the list of arguments passed to the main program siod. (*catch tag body ...) A special form. Tag is evaluated and kept in a special location while all the forms in the body are evaluated. Normally returns the value of the last form except if a *throw is encountered within the dynamic scope of the evaluations. Errors may be caught by using a tag of 'errorobj. *env* A variable, bound to the list of environment values passed to the main program siod. *eval-history-ptr* A variable, default ( ), but if set to a list (possibly circular), then each call to eval will cause the car of the list to receive a pointer to the form being evaluated, and then the variable will be set to the cdr of the list. Useful for writing a retrospective trace debugging capability. *pi* A variable, value 3.1416. *plists* A variable, internal to the implementation of get and putprop. (*throw tag value) Locates an active *catch for which the tag is identical and then forces the *catch form to return the value. *traced* A variable, value is a list of procedures that have been traced. (+ x1 x2 ...) Returns the sum of its arguments. (- x1 x2 ...) With one argument returns the negation; returns the difference of the first argument and the sum of the rest. (/ x1 x2 ...) With one argument returns the inverse; otherwise, returns the quotient of the first argument and the product of the rest. (< x y) Returns true if x is numerically less than y. (<= x y) Returns true if x is numerically less than or equal to y. (= x y) Returns true if x is numerically equal to y. (> x y) Returns true if x is numerically greater than y. (>= x y) Returns true if x is numerically greater than or equal to y. (F_GETLK fd ltype whence start len) The fd may be an integer or file. The function fcntl (U) is called on the file descriptor and an appropriate struct flock constructed from the ltype, whence, start and len arguments, and the lock operation F_GETLK. The ltype may be F_RDLCK,F_UNLCK, or F_WRLCK. Whence may be SEEK_CUR, SEEK_END or SEEK_SET. (F_SETLK fd ltype whence start len) Same as F_GETLCK but with lock operation F_SETLK. U. (F_SETLKW fd ltype whence start len) Same as F_GETLCK but with lock operation F_SETLKW. U. For a good example see the command script cp-build. (abs x) Returns the absolute numerical value of x. (access-problem? filename method) Invokes the access function (U) on the filename and flags created from the method string which should contain one or more of the characters "rwxf"returning non-null if there is a problem with accessing the file in that way. For example: (if (access-problem? "x.y" "r") (error "can't read x.y")) (acos x) Returns the inverse cosine of x. (alarm seconds flag) Invokes the alarm function (U). The handling of which will cause an error to be signaled in so many seconds. But if flag is false, then the error will not be signaled if the alarm took place inside a system call or other critical code section. (allocate-heap) Attempts to allocate (call the C library malloc procedure) to obtain an additional heap. The size of the heap and the maximum number of heaps are determined at startup time. Returns non-null if successful. (and form1 form2 form3 ...) A special form which causes the evaluation of its subforms in order, from left to right, continuing if and only if the subform returns a non-null value. (append l1 l2 l3 l4 ...) Returns a list which is the result of appending all of its arguments. Example: (append '(a b) '(c d)) => (a b c d) (apply function arglist) Applies the function to the argument list arglist. (apropos substring) Returns a list of all symbols containing the given substring. (aref array index) Returns the element of the array at the given index. (array->hexstr string) Takes a string or byte array and returns a string in representing the values of the elements in hex. (aset array index value) Stores the value at the given index in the array. (ash value bits) Arithmetic shift of value a given number of bits to the left (positive) or right (negative). (asin x) Returns the inverse sine of x. (ass key alist function) Returns the first element of the alist such that the function applied to car of the element and the key returns a non-null value. For example: (define (assq x alist) (ass x alist eq?)) (assoc key alist) Same as (ass key alist equal?). (assq key alist) Same as (ass key alist eq?). (assv key alist) Same as (ass key alist eql?). (atan x) Returns the inverse tangent of x. (atan2 x y) Returns the inverse tangent of x/y. (base64decode x) Given a string X in base64 representation returns a string with bytes computed using the base64 decoding algorithm. See rfc1521.txt. (base64encode x) Returns a string computed using the base64 encoding algorithm. (begin form1 form2 ...) A special form which evaluates each of its subforms one after another, returning the value of the last subform. (benchmark-eval nloops exp env) A zero-overhead way of evaluating the exp n times. (benchmark-funcall1 nloops f arg1) A zero-overhead way of calling the function f n times on arg1. (benchmark-funcall2 nloops f arg1 arg2) A zero-overhead way of calling the function f n times on arg1 and arg2. (bit-and x y) Returns the bitwise logical "and" (C language & operator) of numerical arguments x and y. (bit-not x) Returns the bitwise logical complement (C language ~ operator) of numerical argument x. (bit-or x y) Returns the bitwise logical "or" (C language | operator) of numerical arguments x and y. (bit-xor x y) Returns the bitwise logical "xor" (C language ^ operator) of numerical arguments x and y. (butlast x) Returns a new list which has all the elements of the argument x except for the last element. (bytes-append x1 x2 ...) Returns a new byte array by appending its arguments which may be strings or byte arrays. (caaar x) Same as (car (car (car x))). (caadr x) Same as (car (car (cdr x))). (caar x) Same as (car (car x)). (cadar x) Same as (car (cdr (car x))). (caddr x) Same as (car (cdr (cdr x))). (cadr x) Same as (car (cdr x)). (car x) If x is the result of (cons a b), then (car x) is the same as a. (cdaar x) Same as (cdr (car (car x))). (cdadr x) Same as (cdr (car (cdr x))). (cdar x) Same as (cdr (car x)). (cddar x) Same as (cdr (cdr (car x))). (cdddr x) Same as (cdr (cdr (cdr x))). (cddr x) Same as (cdr (cdr x)). (cdr x) If x is the result of (cons a b), then (cdr x) is the same as b. (chdir path) Changes default directory to path. U. (chmod path mode) Changes the file mode of path. U. For example, to add execute access permission to the file f: (chmod f (encode-file-mode (append '(XUSR XGRP XOTH) (cdr (assq 'mode (stat f)))))) (chown path uid gid) Changes file ownership. U. (closedir stream) Closes a directory stream. U. (cond clause1 clause2 ...) A special form where each clause is processed until the predicate expression of the clause evaluates true. Then, each subform in the predicate is evaluated with the value of the last one becoming the value of the cond form: (predicate-expression form1 form2 ...) (cons x y) Allocates a list object with x as the car and y as the cdr. For example: (cons 1 (cons 2 (cons 3 ()))) evaluates to (1 2 3) (cons-array dimension kind) Allocates an array (currently limited to one dimension). The kind may be string, byte, double or lisp (default). (copy-list x) The top level cons objects of x are copied, returning a new list. (cos x) Returns the cosine where x is in units of radians. (cpu-usage-limits soft-limit hard-limit) Invokes getrlimit if the arguments are null or otherwise setrlimit. U. (crypt key salt) A form of string hash. U. (current-resource-usage kind) Kind is the symbol SELF or CHILDREN, calls getrusage, U. (datlength data ctype) Returns the dimension of the data as if viewed as an array by the datref function. (datref data ctype index) References the data as if it were an array of C data type ctype, at the given index. The ctype may be CTYPE_CHAR, CTYPE_DOUBLE, CTYPE_FLOAT, CTYPE_LONG, CTYPE_SHORT, CTYPE_UCHAR, CTYPE_ULONG, or CTYPE_USHORT. The data may be a string or byte array. (decode-file-mode x) Returns a list of symbols given a numerical file mode. (define subform1 subform2) A special form used to assign a value to a variable in one of two ways: (define variable value) or to create a procedure (define (procedure-name arg1 arg2 ...) form1 form2 ...) (delete-file path) Deletes the file specified by path. (delq element list) Deletes the elements of the list which are eq to its first argument. Possibly modifying the list using the set-cdr! operation. (encode-file-mode list) Takes a list of file mode symbols and returns the numerical value. SUID, SGID, RUSR, WUSR, XUSR, RGRP, WGRP, XGRP, ROTH, WOTH, XOTH. (encode-open-flags list) Takes a list of open (U) flag symbols and returns a numerical value. NONBLOCK, APPEND, RDONLY, WRONLY, RDWR, CREAT, TRUNC, EXCL. (endpwent) See U. (env-lookup indentifier environment) Returns an object such that the car is the location where the value of dentifier is stored. (eof-val) Returns the object returned by read upon encountering an end of file condition. (eq? x y) Returns true if x and y are the same object. (equal? x y) Returns true if x and y are equal objects. (eqv? x y) Returns true if x and y are the same object or numerically equal. errobj This variable is assigned to the offending object when the error procedure has been invoked. Useful mainly during interactive debugging. (error message object) Prints the error message, then aborts the current execution by invoking *throw using the symbol errobj as the tag and the cons of the message and the object as the value. Equivalent to: (define (error message object) (if (> (verbose 0)) (writes nil "ERROR: " message "\n")) (set! errobj object) (*throw 'errobj (cons message object))) (eval expression environment) Evaluates the expression in the context of the environment. This is not a special form. For example: (eval (read-from-string "(+ 1 2)")) evaluates to 3. (exec path args env) Calls execv or execve U. (exit status) Calls exit. U. (exp x) Computes the exponential function of x. (fast-load path noeval-flag) Loads a file of binary format expressions; if noeval-flag is true returns a list of the forms instead of evaluating them. (fast-print object state) Outputs a fast (binary) format representation of object, where the state is a list of (file hash-array index). (fast-read state) Inputs a form which had been output in fast (binary) format. (fast-save filename forms nohash-flag comment-string) Creates a file by using fast-print to output each of the forms. A true value for the nohash-flag will cause symbol names to be output each time they are encountered. Otherwise, a more optimal index representation is used. The comment-string is used as the first line of data in the file. (fchmod filedes mode) The filedes may be a number or an open file object. U. (fclose stream) Closes the open file stream. U. (fflush stream) See U. (file-times path) Returns a list of the st_ctime and the st_mtime returned by the stat function. U. (first x) Returns the first element (car) of the list x. (fmod x y) Floating point mod. U. (fnmatch pattern string flags) Returns true if the string matches the pattern. U. (fopen path mode) Opens the file and returns a file stream. U. (fork) Creates a child process. Returning a numerical pid in the parent, ( ) in the child, or call error if the child cannot be created. U. (fread size-or-buffer stream) Returns a new string of size bytes by calling fread (U). Or uses the buffer (a string or a byte array) instead and returns the number of bytes read. Returns ( ) on end of file. (fseek file offset direction) The direction is SEEK_CUR, SEEK_END or SEEK_SET. U. (fstat stream) Calls fstat (U) and returns an alist with elements dev, ino, mode, nlink, uid, gid, rdev, size, atime, mtime, ctime, blksize, blocks, flags and gen. (ftell stream) Calls ftell (U) to return the current offset into a file. (fwrite data stream) Write the data, a string or byte-array to the stream. Or, data can also be a list of a string or byte-array and a numerical length. (gc) Invokes the garbage collector. (gc-info item)
ITEM | VALUE
0 | true if copying gc, false if mark and sweek
1 | number of active heaps
2 | maximum number of heaps
3 | number of objects per heap
4 | amount of consing of objects before next gc
(gc-status [flag]) If flag is not specified, prints information about the gc. Otherwise, flag can be used to turn on or off gc messages or turn on or off the gc itself when in stop and copy mode. (get object key) Returns the key property of the object. (getc stream) Reads a character from the stream, returns ( ) for end of file. U. (getcwd) Returns the current working directory. U. (getenv name) Returns the value of the environment variable named, or ( ). U. (getgid) Returns the group id of the process. U. (getgrgid gid) Returns a list of members of the specified numerical group. U. (getpass prompt) Prompts the user and reads a line with echoing turned off. U. (getpgrp) Returns the process group ID of the calling process. U. (getpid) Returns the process ID of the calling process. U. (getppid) Returns the parent process ID of the calling process. U. (getpwent) Returns an alist representing the next item in the /etc/passwd file. U. (getpwnam username) Returns the /etc/passwd file entry for the given username. U. (getpwuid) Returns the /etc/passwd file entry for the given user id. U. (gets stream) Reads a line from the stream, ( ) on end of file. (getuid) Returns the uid of the current process. U. (gmtime value) Decodes the value into an alist. The value defaults to the current time. U. (hexstr->bytes str) Decodes the hex representation into a byte array. (href table key) The hash table is a one-dimensional array of association lists. (define (href table key) (cdr (assoc key (aref table (sxhash key (length table)))))) (hset table key value) Stores the value into the hash table slot indicated by key. (html-encode str) If str contains any special html characters (<>&), a new string is returned with these replaced by their corresponding representations &lt; &gt; &amp;. (if predicate-form true-form false-form) A special form that evaluates the true-form or the false-form depending on the result of evaluating the predicate form. (intern str) Looks up a string in the symbol table or enters a new symbol. (kill pid sig) Calls the kill function U, with sig defaulting to SIGKILL. (lambda (arg1 arg2 ...) form1 form2 ...) Returns an applicable procedure object (CLOSURE) with the given argument list and expression subforms. For example: (mapcar (lambda (x) (* x x)) '(1 2 3)) evaluates to: (1 4 9) Also used by the define special form. (larg-default list index default-value) References the list according to index, but skipping over strings that begin with a colon or a dash. If the list is not long enough, it returns the default-value instead. Most useful when used with the *args* variable inside a main program. (last list) Returns the last cons in a list. (last-c-error) Returns the value of the C library strerror(errno) (U) interned as a symbol. (lchown path owner group) Changes the ownership of a symbolic link. U. (length object) Returns the length of an object which may be a string (acts like strlen) or a list or an array. (let (binding1 binding2 ...) form1 form2 ...) A special form where each binding is a (variable value) pair. It works by computing the values, establishing the bindings, and then evaluating the forms, returning the value of the last one. For example, the following evaluates to 30: (let ((x 10) (y 20)) (+ x y)) (let* (binding1 binding2 ...) form1 form2 ...) A special form where each binding is a (variable value) pair. It works by sequentially computing each value and then establishing a binding. For example, the following evaluates to 30: (let* ((x 10) (y (+ x 10))) (+ x y)) (letrec (binding1 binding2 ...) form1 form2 ...) Useful when the value forms of the bindings are lambda expressions with which you desire to program mutually recursive calls. (link existing-file entry-to-create) Creates a hard link. U. (list item1 item2 ...) Conses up its arguments into a list. (lkey-default list index default-value) Returns the substring on the right-hand size of the equal sign of the first element of the list of the form index=value, or the default-value if none are found. Useful when processing the *args* value inside a main program. (load fname noeval-flag search-flag) If search-flag is true it looks for fname in the current directory and then in the SIOD_LIB directory. The forms from the file are parsed according to the "parser:xxx" directive at the beginning of the file (default "parser:read"). If the neval-flag is true, then a list of the forms is returned; otherwise, the forms are evaluated. (load-so fname init_fcn) Loads the dynamic library specified by fname, invoking the init_fcn if specified (default init_fname). (localtime value) Returns an alist representing the value as a localtime. U. Value defaults to the current time. (log x) Computes the natural logarithm of x. (lref-default list index default-fcn) Returns the index element of the list or the result of calling the default-fcn if the list is not long enough. (lstat path) Returns the stat information of a logical link. U. (make-list length element) Creates a list of the given length filled with the element specified. (mapcar fcn list1 list2 ...) Returns a list which is the result of applying the fcn to the elements of each of the lists specified. (max x1 x2 ...) Returns the maximum of x1, x2, etc. (md5-final state) Returns a byte array computed from the state, derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm. See rfc1321.txt. Example: (define (md5 str) (let ((s (md5-init))) (md5-update s str) (array->hexstr (md5-final s)))) (md5-init) Returns an md5 algoritm state as a byte array. (md5-update state string length) Performs the update step of the md5 algorithm using data from the string up to length, or length can be an open file object, in which case the data from the file is used to perform the update. (member key list) Returns the portion of the list where the car is equal to the key, or ( ) if none found. (memq key list) Returns the portion of the list where the car is eq to the key, or ( ) if none found. (memv key list) Returns the portion of the list where the car is eqv? to the key, or ( ) if none found. (min x1 x2 ...) Returns the numerical minimum of its arguments. (mkdatref ctype ind) Creates a closure functionally equivalent to (lambda (x) (datref x ctype ind)). (mkdir path mode) Creates a directory with the specified numerical access mode. U. (mktime alist) Returns the numerical time value corresponding to the alist in the same format as returned by the localtime function. U. (nconc l1 l2) Makes the cdr of the last cons of l1 point to l2. (nice increment) Changes the priority of the current process by the increment. U. nil Do not change the value of this variable, which is bound to the empty list. (not x) Returns the reverse truth sense of x. (nreverse list) Destructive reversal of the elements of a list using set-cdr!. (nth index list) References the list using index, with the first element being index 0. (null? x) Returns true if x is the empty list. (number->string x base width precision) Formats the number according to the base, which may be 8, 10, 16 or the symbol e or f. The width and precision are both optional. (number? x) Returns true if x is a number. (opendir path) Returns a directory stream. Note that in UNIX, path is the name of a directory, but in WIN32 path is a wildcard pattern. U. (or form1 form2 ...) A special form which causes the evaluation of its subforms in order, from left to right until a form evaluates to a non-null value. (os-classification) Returns UNIX, win32, vms. (pair? x) Returns true if x is a pair (created by cons). (parse-number str) Convers a string to a number. (pclose stream) Used to close a stream opened using popen. Makes sure the associated process is killed. U. (popen command type) Executes the command in a child process and opens a stream connected to the process standard output if type is r, or the standard input if type is w. U. (pow x y) Computes the result of x raised to the y power. (prin1 object stream) Outputs the standard readable representation of the object to the stream, which defaults to the standard output. (print object stream) Same as prin1 followed by output of a newline. (print-to-string object string no-trunc-flag) Puts the readable representation of the object into the string, starting at the first character unless the no-trunc-flag is true, in which case the representation starts at the current length of the string. (prog1 form1 form2 form3 ...) A special form which evaluates all its subforms but returns the value of the first one. A useful shorthand to employ instead of using a let. (putc char stream) Outputs the character to the stream. U. (putenv setting) With setting of the form "key=value", this makes a new environment binding available to the getenv function of the current and subsequent child processes, or updates an old one. U. (putprop object value key) Not implemented. (puts string stream) Outputs the string to the stream. U. (qsort list predicate-fcn access-fcn) Implements the recursive quicksort algorithm on elements of the list compared by using the predicate-fcn on the results of invoking the access-fcn.
Example | Result
(qsort '(3 1 5 4 2) <) | (1 2 3 4 5)
(qsort '((3 a) (2 b)) < car) | ((2 b) (3 a))
(quit) Causes the read-eval-print loop to return, usually resulting in an exit from the main program of siod, but may not when other C programs are utilizing the libsiod functionality. (quote x) A special form that returns x without evaluating it. Commonly written in abbreviated format as 'x. (rand modulus) Computes a random number from 0 to modulus-1. Uses C library rand. (random modulus) Computes a random number from 0 to modulus-1. Uses C library random. (read stream) Inputs characters from the stream; returns the parsed standard expression, or (eof-val). (read-from-string string) Performs a read operation on the characters in the string. (readdir directory-stream) Returns the name of the next entry in the directory stream or ( ) of none left. (readline stream) Reads a line of characters from the stream, returning ( ) on end of file. The terminating newline is not included in the string, which is usually more convenient. For example, this procedure for loading a tab-delimited spreadsheet file: (define (load-spread-sheet filename) (if (>= (verbose) 2) (writes nil ";; loading spread sheet " filename "\n")) (let ((result nil) (line nil) (f (and (not (equal? filename "-")) (fopen filename "r")))) (while (set! line (readline f)) (set! result (cons (strbreakup line "\t") result))) (and f (fclose f)) (nreverse result))) (readlink path) Returns the contents of the symbolic link at path. U. (realtime) Returns a double precision floating point value representation of the current realtime number of seconds. Usually precise to about a thousandth of a second. (rename from-path to-path) Renames a directory or file within a file system. U. (require path) Computes a variable name by concatenating "*" + path + "-loaded*" and then calling (load path nil t) if and only if the variable is not bound to true. After the file is loaded the variable is set to true. This is the correct way of making sure a file is only loaded once. (require-so path) Computes a variable name by concatenating "init_" + path, and calling (load-so path) if and only if the variable is not bound to true. After the shared library has been loaded the variable is set to true. The correct way of making sure a shared library is only loaded once is: (require-so (so-ext 'name)) (rest x) Returns the rest of the list x, in other words, the cdr. (reverse x) Returns a new list which has elements in the reverse order of the list x. (rld-pathnames) Returns a list of the pathnames which represent shared libraries that have been loaded by the current process. (rmdir path) Removes the directory entry specified by path. U. (runtime) Returns a list containing the current cpu usage in seconds and the subset amount of cpu time that was spent performing garbage collection during the currently extant read-eval-print loop cycle. (save-forms filename forms how) Prints the forms to the file, where how can be "w" (default) or "a" to append to the file. (sdatref spec data) Used as the %%closure-code by mkdatref. (set! variable value) A special form that evaluates the value subform to get a value, and then assigns the variable to the value. (set-car! cons-cell value) Changes the car of the cons-cell object to point to the value. (set-cdr! cons-cell value) Changes the cdr of the cons-cell object to point to the value. (set-eval-history length circular-flag) Creates a list of the specified length and establishes bindings for *eval-history-ptr* and *eval-history*. The list is circular if the flag is specified true. Try the following: (define (fib x) (if (< x 2) x (+ (fib (- x 1)) (fib (- x 2))))) (set-eval-history 200) (fib 10) (mapcar (lambda (x) (if (pair? x) (car x) x)) *eval-history*) (set-symbol-value! symbol value env) Finds the location of the value cell for the specified symbol in the environment env and sets the value. (setprop obj key value) Not implemented. (setpwent) Resets the pointer into the /etc/passwd file. U. (setuid x) Sets the userid of the process. U. (sin x) Computes the sine function of the angle x in radians. (siod-lib) Return the setting of the siod library directory. (sleep n) Sleeps for n seconds, where n may be fractional on some systems. (so-ext path) Appends the path with the file extension for shared libraries. (sqrt x) Computes the square root of x. (srand seed) Resets the algorithm seed for the rand function. U. (srandom seed) Resets the algorithm seed for the random function. U. (stat path) Returns an alist describing file status information, or ( ) if the path cannot be accessed (last-c-error), may be used to return the reason. (strbreakup string sep) Returns a list of the portions of string indicated by the separator. (strbreakup "x=y&z=3" "&") => ("x=y" "z=3") (strcat str1 str2) Copies the string str2 into str1 starting at the current active end of str1, which is determined by the location of a 0 byte, calling error if there is not enough room left in str1. U. (strcmp str1 str2) Returns 0 if str1 and str2 are equal, or -1 if str1 is alphabetically less than str2 or 1 otherwise. U. (strcpy str1 str2) Copies str1 into str1 or calling error if there is not enough room. U. (strcspn str indicators) Returns the location of the first character in str which is found in the indicators set; returns the length of the string if none found. U. (strftime format-string alist) Uses the format-string to compute a string using broken-up time/data information from the alist (defaults to the current time) U, for example: (strftime "%B" '((mon . 3))) => "April" (string->number str radix) Converts the string to a number assuming the specified radix. (string-append str1 str2 str3 ...) Returns a new string which contains the concatenation of all its string arguments. (string-dimension str) Returns the maximum possible length of a string array. (string-downcase str) Returns a new string converting all the characters of str to lowercase. (string-length str) Returns the active string length of str. (string-lessp str1 str2) Returns true if str1 is alphabetically less than str2. (string-search key str) Locates the index of the key in the specified string. Returns ( ) if not found. (string-trim str) Returns a new string made by trimming whitespace from the left and right of the specified string. (string-trim-left str) Like string-trim, but only the left-hand side. (string-trim-right str) Like string-trim, but only the right-hand side. (string-upcase str) Returns a new string with all the lowercase characters converted to uppercase. (string? x) Returns true if x is a string. (strptime str format alist) Parses str according to format and merges the values with the alist. U. (cdr (assq 'mon (strptime "March" "%B"))) => 2 (strspn str indicators) Returns the location of the first character in str which is not found in the indicators set; returns the length of the str if none found. U. For example: (define (string-trim-left x) (substring x (strspn x " \t"))) (subset pred-fcn list) Returns the subset of the list such that the elements satisfy the pred-fcn. For example: (subset number? '(1 b 2 c)) => (1 2) (substring str start end) Returns a new string made up of the part of str beginning at start and terminating at end. In other words, the new string has a length of end - start. (substring-equal? str str2 start end) An efficient way to determine if the substring of str2 specified by start and end is equal to str1. (swrite stream table form) This is the same as the write-smart-html procedure described in ftp://ftp.std.com/pub/gjc/www95-paper.html. (sxhash data modulus) Computes a recursive hash of the data with respect to the specified modulus. (symbol-bound? symbol env) Returns true if the symbol is bound in the environment. (symbol-value symbol env) Returns the value of the symbol in the environment. (symbol? x) Returns true if x is a symbol. (symbolconc arg1 arg2 ...) Slightly more efficient than calling intern on the result of using string-append on the arguments. This procedure actually predates the availability of the string data type in SIOD. (symlink contents-path link-path) Creates a directory entry link-path pointing to the contents-path. U. (system arg1 arg2 ...) Appends the string arguments to form a command to be executed by the operating system. U. t Please do not change the global value of this variable, bound to a true value. (tan x) Computes the tangent of the angle x specified in radians. (the-environment) A special form which returns the interpreter environment structure for the current lexical scope. (trace fcn1 fcn2 ...) Traces the specified interpreted procedures by modifying the closure objects. (trunc x) Returns the integer portion of x. (typeof x) Returns a symbol describing the type of the object x, or the integer type code. (unbreakupstr list sep) The reverse of strbreakup. The following example saves a list of lists as a tab delimited spreadsheet: (define (save-spread-sheet filename data) (if (>= (verbose) 2) (writes nil ";; saving spread sheet " filename "\n")) (let ((result data) (f (and (not (equal? filename "-")) (fopen filename "w")))) (while result (writes f (unbreakupstr (car result) "\t") "\n") (set! result (cdr result))) (and f (fclose f)))) (ungetc char stream) Puts the char back into the stream for the next call to getc. (unix-ctime x) Converts the integer time x into a string. U (unix-time) Returns the current number of seconds since 1-JAN-1970 GMT. U (unix-time->strtime x) Returns a string of the form "YYYYMMDDHHmmSSdd" which is useful in some contexts. This predates the availability of the strftime procedure. (unlink path) Deletes the specified entry from the directory structure. U (untrace fcn1 fcn2 ...) Untraces the specified procedures. (url-decode str) Performs the url decode operation on the str. See people.delphi.com/gjc/chtml.html for example usage. (url-encode str) Locates characters in the str which should not appear in a url, and returns a new string where they have been converted to the %NN hex representation. Spaces are converted to "+" signs. (utime path modification-time access-time) Sets the file modification and access times. U (verbose arg) Sets the verbosity level of SIOD to the specified level or returns the current level if not specified.

Table C.1 Verbose arguments

Verbose Level | Effect on System
0 | No messages.
1 | Error messages only.
2 | Startup messages, prompts, and evaluation timing.
3 | File loading and saving messages.
4 (default) | Garbage collection messages.
5 | display of data loaded from files and fetched from databases.
(wait pid options) Waits on a child process by calling the waitpid function, where options may be a list containing (WCONTINUED WNOWAIT WNOHANG WUNTRACED). Returns a list of the process pid and final exit status. The fork-test.scm and http-stress.scm modules provide example usage. U (while pred-form form1 form2 ...) If pred-form evaluates true, it will evaluate all the other forms and then loop. (writes stream data1 data2 data3 ...) Outputs the data arguments to the stream without quoting strings or special characters.

Frozenriver Digital Design http://www.frozenriver.nu Voice: +46 (0)31 474356 Fax: +46 (0)31 493833 support@frozenriver.com | Publisher Coriolis http://www.coriolis.com