1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-30 00:40:20 +02:00

(Fly Evaluation): In apply, reword for

clarity, drop the "append" example.  Add scm_apply, scm_apply_0,
scm_apply_1, scm_apply_2, scm_apply_3.
Add scm_call_0, scm_call_1, scm_call_2, scm_call_3.
In apply:nconc2last, move down after "apply", reword for clarity, note
correspondence to apply params.
This commit is contained in:
Kevin Ryde 2003-07-18 01:21:05 +00:00
parent 0a52dd4768
commit 0e97e58d9d

View file

@ -215,22 +215,45 @@ While the code is evaluated, the given module is made the current one.
The current module is restored when this procedure returns. The current module is restored when this procedure returns.
@end deffn @end deffn
@deffn {Scheme Procedure} apply:nconc2last lst @deffn {Scheme Procedure} apply proc arg1 @dots{} argN arglst
@deffnx {C Function} scm_nconc2last (lst) @deffnx {C Function} scm_apply_0 (proc, arglst)
Given a list (@var{arg1} @dots{} @var{args}), this function @deffnx {C Function} scm_apply_1 (proc, arg1, arglst)
conses the @var{arg1} @dots{} arguments onto the front of @deffnx {C Function} scm_apply_2 (proc, arg1, arg2, arglst)
@var{args}, and returns the resulting list. Note that @deffnx {C Function} scm_apply_3 (proc, arg1, arg2, arg3, arglst)
@var{args} is a list; thus, the argument to this function is @deffnx {C Function} scm_apply (proc, arg, rest)
a list whose last element is a list. @rnindex apply
Note: Rather than do new consing, @code{apply:nconc2last} Call @var{proc} with arguments @var{arg1} @dots{} @var{argN} plus the
destroys its argument, so use with care. elements of the @var{arglst} list.
@code{scm_apply} takes parameters corresponding to a Scheme level
@code{(lambda (proc arg . rest) ...)}. So @var{arg} and all but the
last element of the @var{rest} list make up
@var{arg1}@dots{}@var{argN} and the last element of @var{rest} is the
@var{arglst} list. Or if @var{rest} is the empty list @code{SCM_EOL}
then there's no @var{arg1}@dots{}@var{argN} and @var{arg} is the
@var{arglst}.
@var{arglst} is not modified, but the @var{rest} list passed to
@code{scm_apply} is modified.
@end deffn @end deffn
@rnindex apply @deffn {C Function} scm_call_0 (proc)
@deffn {Scheme Procedure} apply proc arg1 @dots{} args @deffnx {C Function} scm_call_1 (proc, arg1)
@var{proc} must be a procedure and @var{args} must be a list. Call @deffnx {C Function} scm_call_2 (proc, arg1, arg2)
@var{proc} with the elements of the list @code{(append (list @var{arg1} @deffnx {C Function} scm_call_3 (proc, arg1, arg2, arg3)
@dots{}) @var{args})} as the actual arguments. Call @var{proc} with the given arguments.
@end deffn
@deffn {Scheme Procedure} apply:nconc2last lst
@deffnx {C Function} scm_nconc2last (lst)
@var{lst} should be a list (@var{arg1} @dots{} @var{argN}
@var{arglst}), with @var{arglst} being a list. This function returns
a list comprising @var{arg1} to @var{argN} plus the elements of
@var{arglst}. @var{lst} is modified to form the return. @var{arglst}
is not modified, though the return does share structure with it.
This operation collects up the arguments from a list which is
@code{apply} style parameters.
@end deffn @end deffn
@deffn {Scheme Procedure} primitive-eval exp @deffn {Scheme Procedure} primitive-eval exp