chickadee » chicken » parameters

Outdated CHICKEN release

This is a manual page for an old and unsupported version of CHICKEN. If you are still using it, please consider migrating to the latest version. You can find the manual for the latest release here.

Parameters

Parameters are CHICKEN's form of dynamic variables, except that they are procedures rather than actual variables. A parameter is a procedure of zero or one arguments. To retrieve the value of a parameter call the parameter-procedure with zero arguments. To change the setting of the parameter, call the parameter-procedure with the new value as argument:

(define foo (make-parameter 123))
(foo)                             ==> 123
(foo 99)
(foo)                             ==> 99

Parameters are fully thread-local, each thread of execution owns a local copy of a parameters' value.

CHICKEN implements SRFI-39.

make-parameter

make-parameter VALUE #!optional GUARDprocedure

Returns a procedure that accepts zero or one argument. Invoking the procedure with zero arguments returns VALUE. Invoking the procedure with one argument changes its value to the value of that argument and returns the new value (subsequent invocations with zero parameters return the new value). GUARD should be a procedure of a single argument. Any new values of the parameter (even the initial value) are passed to this procedure. The guard procedure should check the value and/or convert it to an appropriate form.

Built-in parameters

Certain behavior of the interpreter and compiled programs can be customized via the following built-in parameters:

case-sensitive

case-sensitiveparameter

If true, then read reads symbols and identifiers in case-sensitive mode and uppercase characters in symbols are printed escaped. Defaults to #t.

dynamic-load-libraries

dynamic-load-librariesparameter

A list of strings containing shared libraries that should be checked for explicitly loaded library units (this facility is not available on all platforms). See load-library.

command-line-arguments

command-line-argumentsparameter

Contains the list of arguments passed to this program, with the name of the program and any runtime options (all options starting with -:) removed.

current-read-table

current-read-tableparameter

A read-table object that holds read-procedures for special non-standard read-syntax (see set-read-syntax! for more information).

exit-handler

exit-handlerparameter

A procedure of a single optional argument. When exit is called, then this procedure will be invoked with the exit-code as argument. The default behavior is to terminate the program.

eval-handler

eval-handlerparameter

A procedure of one or two arguments. When eval is invoked, it calls the value of this parameter with the same arguments. The default behavior is to evaluate the argument expression and to ignore the second parameter.

force-finalizers

force-finalizersparameter

If true, force and execute all pending finalizers before exiting the program (either explicitly by exit or implicitly when the last toplevel expression has been executed). Default is #t.

implicit-exit-handler

implicit-exit-handlerparameter

A procedure of no arguments. When the last toplevel expression of the program has executed, then the value of this parameter is called. The default behaviour is to invoke all pending finalizers.

keyword-style

keyword-styleparameter

Enables alternative keyword syntax, where STYLE may be either #:prefix (as in Common Lisp), which recognizes symbols beginning with a colon as keywords, or #:suffix (as in DSSSL), which recognizes symbols ending with a colon as keywords. Any other value disables the alternative syntaxes. In the interpreter the default is #:suffix.

parentheses-synonyms

parentheses-synonymsparameter

If true, then the list delimiter synonyms #\[ #\] and #\{ #\} are enabled. Defaults to #t.

symbol-escape

symbol-escapeparameter

If true, then the symbol escape #\| #\| is enabled. Defaults to #t.

load-verbose

load-verboseparameter

A boolean indicating whether loading of source files, compiled code (if available) and compiled libraries should display a message.

program-name

program-nameparameter

The name of the currently executing program. This is equivalent to (car (argv)) for compiled programs or the filename following the -script option in interpreted scripts.

repl-prompt

repl-promptparameter

A procedure that should evaluate to a string that will be printed before reading interactive input from the user in a read-eval-print loop. Defaults to (lambda () "#;N> ").

reset-handler

reset-handlerparameter

A procedure of zero arguments that is called via reset. The default behavior in compiled code is to invoke the value of (exit-handler). The default behavior in the interpreter is to abort the current computation and to restart the read-eval-print loop.

recursive-hash-max-depth

recursive-hash-max-depthparameter

The maximum structure depth to follow when computing a hash value. The default is 4.

recursive-hash-max-length

recursive-hash-max-lengthparameter

The maximum vector length to follow when computing a hash value. The default is 4.


Previous: Declarations Next: Exceptions

Contents »