François Pinard wrote: > [Roland Rau] > >> [François Pinard] >> > > >>> I wonder what happened, for R to hide the underlying Scheme so fully, >>> at least at the level of the surface language (despite there are >>> hints). >>> > > >> "To further foster portability, we chose to write R in ANSI C...." >> > > Yes, of course. Scheme is also (often) implemented in C. I meant that > R might have implemented a Scheme engine (or part of a Scheme engine, > extended with appropriate data types) with a surface language (nearly > the S language) which is purposely not Scheme, but could have been. > > If the gap is not extreme, one could dare dreaming that the Scheme > engine in R be "completed", and Scheme offered as an alternate extension > language. If you allow me to continue dreaming awake -- "they" told me > "they" will let me free as long as I do not get dangerous! :-) -- part > of the interest lies in the fact there are excellent Scheme compilers. > If we could only find or devise some kind of marriage between a mature > Scheme and R, so to speed up the non-vectorisable parts of R scripts... > > Well, depending on what you want, this is either trivial or impossible... The internal storage of R is still pretty much equivalent to scheme. E.g. try this:
> r2scheme <- function(e) if (!is.recursive(e)) deparse(e) else c("(", unlist(lapply(as.list(e), r2scheme)), ")") > paste(r2scheme(quote(for(i in 1:4)print(i))), collapse=" ") [1] "( for i ( : 1 4 ) ( print i ) )" and a parser that parses a similar language to R internal format is not a very hard exercise (some care needed in places). However, replacing the front-end is not going to make anything faster, and the evaluation engine in R does a couple of tricks which are not done in Scheme, notably lazy evaluation, and other forms of non-local evaluation, which drives optimizers crazy. Look up the writings of Luke Tierney on the matter to learn more. >> If we are lucky and one of the original authors reads this thread they >> might explain the situation further and better [...]. >> > > In r-devel, maybe! We would be lucky if the authors really had time to > read r-help. :-) > > -- O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.