This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: apply vs. @apply


Maciej Stachowiak <mstachow@mit.edu> writes:

> I noticed that Guile has an `apply' primitive, however, when
> boot-9.scm is loaded, it loads r4rs.scm which redefines `apply' in
> terms of the `@apply' macro and `apply:nconc2last'. It seems to me
> that at least one of these definitions of `apply' should be
> removed.

The primitive is used for bootstrapping until it is overridden by the
scheme version.  The primitive is, in addition, used internally in
Guile in lots of places.

The scheme version is also needed since it is tail-recursive.

> Other points: if the `@apply' version is kept, is there a way
> to remove the need to have it also use `apply:nconc2last'? It seems to
> me that this is an implementation detail that should be left at the C
> level.

apply:nconc2last can easily be called from within the evaluator
instead.  That would also be slightly more efficient.

> Also, if the C-implemented `apply' is fine and the comments
> about having to implement it in Scheme in terms of a macro to make it
> properly tail-recursive no longer apply,

What made you think they wouldn't apply?  They do.

/mdj