Skip to content

MiscellaneousAPI

Mike Montague edited this page May 12, 2022 · 5 revisions

These procedures are in addition to the procedures specified by R7RS. (import (foment base)) to use these procedures.

Procedure Properties

procedure: (procedure-property proc key)
procedure: (procedure-property proc key default)

Return the value associated with key in the properties of proc. If there is no value associated key then either default, if supplied, or #f is returned. proc must be a procedure.

procedure: (set-procedure-property! proc key value)

Set the value of associated with key in the properties of proc to be value. proc must be a procedure.

Assignments

syntax: (set!-values (var ...) expr)

expr is evaluated and must return as many values as there are vars. Each var is set to the corresponding value returned by expr.

Exceptions

Error objects contains type, who, message, and irritants fields. Type is a symbol, typically one of error, assertion-violation, implementation-restriction, lexical-violation, syntax-violation, or undefined-violation. Who is a symbol, typically which procedure raised the exception. Message is a string explaining the error to be displayed to the user. Irritants is a list of additional context for the error.

procedure: (error-object-type error-object)

Return the type field of error-object.

procedure: (error-object-who error-object)

Return the who field of error-object.

procedure: (error-object-kind error-object)

Return the kind field of error-object.

procedure: (full-error type who kind message obj ...)

Raise an exception by calling raise on a new error object. The procedure error could be defined in terms of full-error as follows.

(define (error message . objs)
    (apply full-error 'assertion-violation 'error #f message objs))

Libraries

procedure: (loaded-libraries)

Return the list of loaded libraries.

procedure: (library-path)

Return the library path. The command line options, -A and -I, and the environment variable FOMENT_LIBPATH can be used to add to the library path.

Miscellaneous

procedure: (full-command-line)

Return the full command line as a list of strings. command-line returns after all options have been removed.

Configuration

procedure: (config)

Returns a list of configuration options.

procedure: (set-config! option value)

Only some configuration options are settable at runtime; some are only settable as command line options. Set option to value; an exception will be raised if option is not settable at runtime.

Clone this wiki locally