For Gauche 0.9.15Search (procedure/syntax/module):

Next: , Previous: , Up: Library modules - SRFIs   [Contents][Index]

11.52 srfi.216 - SICP prerequisites

Module: srfi.216

This module provides several utility procedures to write code and implement exercises of “Structure and Interpretation of Computer Programs”.

We provide this module for the portability, i.e. to run existing code that depends on this module. If you’re studying SICP and writing code by yourself using Gauche, we recommend you to install Gauche-compat-sicp extension (, for it takes care of Gauche-specific matters.

Constant: true
Constant: false
Constant: nil

[SRFI-216]{srfi.216} Constants bound to #t, #f, and (), respectively.

Function: runtime

[SRFI-216]{srfi.216} Returns an exact integer monotonically increasing from certain point of time in the past. The absolute value doesn’t matter, but you can use differences of calls to runtime to compare relative elapsed time.

Function: random n

[SRFI-216]{srfi.216} The argument n must be a positive real number. Returns a random nonnegative integer less than n.

If n is exact, an exact integer is returned. Otherwise, an inexact integeer is returned.

Function: parallel-execute thunk thunk2 …

[SRFI-216]{srfi.216} Run given thunks in parallel using threads. Returns an undefined value after all thunks are completed.

Function: test-and-set! pair

[SRFI-216]{srfi.216} The argument must be a mutable pair. If its car is #f, set it to #t and returns #f. Otherwise returns #t without modifying the argument. The operation is performed atomically.

Macro: cons-stream a b

[SRFI-216]{srfi.216} Expands into (cons a (delay b)). Note that the car side of stream (a) is eagerly evaluated.

This is not compatible with’s stream-cons (see Stream primitives). The reason SICP need this as primitive is that SICP does not use macros, so it can’t define its own syntactic abstraction.

Constant: the-empty-stream

[SRFI-216]{srfi.216} A singleton instance of the empty stream. This should be used with the following stream-null?. Note that this is not compatible with stream-null of (see Stream primitives).

Function: stream-null? obj

[SRFI-216]{srfi.216} Returns #t if obj is equivalent to the-empty-stream, #f otherwise. Note that this is not the same as stream-null? of (see Stream primitives).

Next: , Previous: , Up: Library modules - SRFIs   [Contents][Index]

For Gauche 0.9.15Search (procedure/syntax/module):