diff options
author | Kevin Ryde <user42@zip.com.au> | 2003-07-18 01:21:05 +0000 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2003-07-18 01:21:05 +0000 |
commit | 0e97e58d9d24d0f80bc74156dbfae1729c3b4ce7 (patch) | |
tree | ea08e119cb33f18e68186a8785f48c0830b81781 | |
parent | 0a52dd47689340898a0052e7c93f6131494d2d46 (diff) | |
download | guile-0e97e58d9d24d0f80bc74156dbfae1729c3b4ce7.tar.gz |
(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.
-rw-r--r-- | doc/ref/scheme-evaluation.texi | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/doc/ref/scheme-evaluation.texi b/doc/ref/scheme-evaluation.texi index cb6ddfb7b..a1fee40b5 100644 --- a/doc/ref/scheme-evaluation.texi +++ b/doc/ref/scheme-evaluation.texi @@ -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. @end deffn -@deffn {Scheme Procedure} apply:nconc2last lst -@deffnx {C Function} scm_nconc2last (lst) -Given a list (@var{arg1} @dots{} @var{args}), this function -conses the @var{arg1} @dots{} arguments onto the front of -@var{args}, and returns the resulting list. Note that -@var{args} is a list; thus, the argument to this function is -a list whose last element is a list. -Note: Rather than do new consing, @code{apply:nconc2last} -destroys its argument, so use with care. +@deffn {Scheme Procedure} apply proc arg1 @dots{} argN arglst +@deffnx {C Function} scm_apply_0 (proc, arglst) +@deffnx {C Function} scm_apply_1 (proc, arg1, arglst) +@deffnx {C Function} scm_apply_2 (proc, arg1, arg2, arglst) +@deffnx {C Function} scm_apply_3 (proc, arg1, arg2, arg3, arglst) +@deffnx {C Function} scm_apply (proc, arg, rest) +@rnindex apply +Call @var{proc} with arguments @var{arg1} @dots{} @var{argN} plus the +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 -@rnindex apply -@deffn {Scheme Procedure} apply proc arg1 @dots{} args -@var{proc} must be a procedure and @var{args} must be a list. Call -@var{proc} with the elements of the list @code{(append (list @var{arg1} -@dots{}) @var{args})} as the actual arguments. +@deffn {C Function} scm_call_0 (proc) +@deffnx {C Function} scm_call_1 (proc, arg1) +@deffnx {C Function} scm_call_2 (proc, arg1, arg2) +@deffnx {C Function} scm_call_3 (proc, arg1, arg2, arg3) +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 @deffn {Scheme Procedure} primitive-eval exp |