Scheme base library for control features
. __Authors:__ Joseph Wayne Norton ([`[email protected]`](mailto:[email protected])).'$scml_exports'/0 | |
'call-with-values'/5 | Calls its producer argument with no values and a continuation
that, when passed some values, calls the consumer procedure with
those values as arguments. The continuation for the call to
consumer is the continuation of the call to |
'call/cc'/4 | Packages the current continuation as an "escape procedure" and
passes it as an argument to |
'dynamic-wind'/6 | Calls
|
'for-each'/4 | Applies proc element-wise to the elements of the lists and returns #f. Calls proc for its side effects rather than for its values. Unlike map, for-each is guaranteed to call proc on the elements of the lists in order from the first element(s) to the last. If more than one list is given and not all lists have the same length, for-each terminates when the shortest list runs out. . |
'procedure?'/1 | Returns #t if obj is a procedure, otherwise returns #f. . |
'string-for-each'/4 | Equivalent to 'for-each'([Proc | Args]). |
'string-map'/4 | Equivalent to map([Proc | Args]). |
'vector-for-each'/4 | Equivalent to 'for-each'([Proc | Args]). |
'vector-map'/4 | Equivalent to map([Proc | Args]). |
apply/4 | Calls |
map/4 | Applies proc element-wise to the elements of the lists and returns a list of the results, in order. If more than one list is given and not all lists have the same length, map terminates when the shortest list runs out. The dynamic order in which proc is applied to the elements of the lists is unspecified. . |
values/4 | Delivers all of its arguments to its continuation. . |
'$scml_exports'() -> [{scm_symbol(), scmi_nip()}]
'call-with-values'(Producer::scm_thunk(), Consumer::scm_proc(), Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scm_any()
Calls its producer argument with no values and a continuation
that, when passed some values, calls the consumer procedure with
those values as arguments. The continuation for the call to
consumer is the continuation of the call to call-with-values
.
'call/cc'(Proc::scm_proc(), Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scm_any()
Equivalent to 'call-with-current-continuation(Proc)'
.
Packages the current continuation as an "escape procedure" and
passes it as an argument to Proc
. The escape procedure is a
Scheme procedure that, if it is later called, will abandon whatever
continuation is in effect at that later time and will instead use
the continuation that was in effect when the escape procedure was
created. Calling the escape procedure will cause the invocation of
before and after thunks installed using dynamic-wind
.
'dynamic-wind'(Before::scm_thunk(), Thunk::scm_thunk(), After::scm_thunk(), Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scm_any()
Calls Thunk
without arguments, returning the result(s) of
this call. Before
and After
are called, also without arguments,
as required. Note that, in the absence of calls to continuations
captured using call/cc
, the three arguments are called once each,
in order.Before
is called whenever execution enters the dynamic
extent of the call to Thunk
and After
is called whenever it
exits that dynamic extent. The Before
and After
thunks are
called in the same dynamic environment as the call to
dynamic-wind
.
No special handling is given for escapes that might occur inside
the +Before+ and +After+ thunks. It protects the +Thunk+ by its
continuation that enforces the following three rules.
-
Its normal continuation is for
Before
to be called beforeThunk
, which is called beforeAfter
, and finally to return the value of the evaluation ofThunk
as the value of the entire dynamic-wind expression. -
If an escape is made out of the
Thunk
,dynamic-wind
guarantees that theAfter
will be called before the escape occurs. -
If an escape is made into the
Thunk
, it guarantees that theBefore
will be called before control is returned to the place of initial escape in theThunk
, and finally theAfter
is called.
'for-each'(Args::[scm_any(), ...], Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scm_false()
Applies proc element-wise to the elements of the lists and returns #f. Calls proc for its side effects rather than for its values. Unlike map, for-each is guaranteed to call proc on the elements of the lists in order from the first element(s) to the last. If more than one list is given and not all lists have the same length, for-each terminates when the shortest list runs out.
'procedure?'(Exp::scm_obj()) -> scm_boolean()
Returns #t if obj is a procedure, otherwise returns #f.
'string-for-each'(Args::[scm_any(), ...], Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scm_false()
Equivalent to 'for-each'([Proc | Args])
.
'string-map'(Args::[scm_any(), ...], Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scm_string()
Equivalent to map([Proc | Args])
.
'vector-for-each'(Args::[scm_any(), ...], Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scm_false()
Equivalent to 'for-each'([Proc | Args])
.
'vector-map'(Args::[scm_any(), ...], Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scm_vector()
Equivalent to map([Proc | Args])
.
apply(Arg::[scm_any(), ...], Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scm_any()
Calls Proc
with the elements of the list (append (list arg1
\.\.\.) args)
as the actual arguments.
map(Args::[scm_any(), ...], Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> [scm_any()]
Applies proc element-wise to the elements of the lists and returns a list of the results, in order. If more than one list is given and not all lists have the same length, map terminates when the shortest list runs out. The dynamic order in which proc is applied to the elements of the lists is unspecified.
values(Args::[scm_any(), ...], Env::scmi_denv(), Ok::scmi_dok(), Ng::scmi_dng()) -> scm_any()
Delivers all of its arguments to its continuation.