This is the mail archive of the firstname.lastname@example.org 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]|
email@example.com writes: > Maciej Stachowiak <firstname.lastname@example.org> 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. Since the first thing boot-9.scm does is load r4rs.scm, and the first thing r4rs.scm does is set! apply to the Scheme version, I can't imagine what bootstrapping this would be. > The primitive is, in addition, used internally in Guile in lots of > places. Yes but that does not require exporting it to Scheme as far as I can tell. > > 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. > That's what I was thinking, especially since that is what scm_apply essentially does. > 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. I have no idea why they would or wouldn't, I never understood the meaning of that comment in the first place. I thought since there was a C-implemented and exported `apply' and some pains are taken to specially declare it (it's not done with a scm_proc) that it might work for some unknown magical reason. - Maciej