Composite libraries

eval

[R6RS]The (rnrs eval (6)) library allows a program to create Scheme expressions as data at run time and evaluate them.

[R6RS] Evaluates expression in the specified environment and returns its value. Expression must be a syntactically valid Scheme expression represented as a datum value.

R6RS requires envionment an envitonment which must be created by the environment procedure. However on Sagittarius, environment can be anything. This behaviour might be fixed in future.

[R6RS] Import-spec must be a datum representing an import spec. The environment procedure returns an environment corresponding to import-spec.

Mutable pairs

[R6RS] This library exports set-car! and set-cdr!.

[R6RS] Store obj in the car/cdr field of pair. These procedures return unspecified value.

On Sagittarius Scheme, these procedures can modify immutable pairs.

Mutable strings

[R6RS] This library exports string-set! and string-fill!.

[R6RS] K must be a valid index of string.

The string-set! procedure stores char in element k of string and returns unspecified values.

[R6RS+] Stores char in every element of the given string and returns unspecified values. Optional arguments start and end restrict the ragne of filling.

Passing an immutable string to these procedures cause an exception with condition type &assertion to be raised.

R5RS compatibility

This library provides R5RS compatibility procedures such as exact->inexact.

[R6RS] These are the same as the inexact and exact procedures.

[R6RS] Returns the quotient, remainder and modulo of dividing an integer n1 by an integer n2, respectively. The result is an exact number only if both n1 and n2 are exact numbers.

[R6RS] The delay construct is used together with the procedure force to implement lazy evaluation or call by need. (delay _expression_) returns an object called a promise which at some point in the future may be asked (by the force procedure) to evaluate expression, and deliver the resulting value. The effect of expression returning multiple values is unspecified.

[R6RS] Promise must be a promise.

The force procedure forces the value of promise. If no value has been computed for the promise, then a value is computed and returned. The value of the promise is cached (or "memoized") so that if it is forced a second time, the previously computed value is returned.

[R6RS] N must be the exact integer object 5. These procedures return an environment which is suitable to use with eval.