srfi.216
- SICP prerequisites ¶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 (https://github.com/shirok/Gauche-compat-sicp), for it takes care of Gauche-specific matters.
[SRFI-216]{srfi.216
}
Constants bound to #t
, #f
, and ()
, respectively.
[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.
[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.
[SRFI-216]{srfi.216
}
Run given thunks in parallel using threads. Returns an undefined
value after all thunks are completed.
[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.
[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 util.stream
’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.
[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 util.stream
(see Stream primitives).
[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 util.stream
(see Stream primitives).