[Rd] Computer algebra in R - would that be an idea??

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sun Jul 17 14:55:38 CEST 2005


Ayal Pinkus <apinkus at xs4all.nl> writes:

> Hi,
> I am the maintainer of Yacas. I decided to join this mailing list  
> after having heard that
> the option of linking R to Yacas was being discussed. Please don't  
> hesitate to ask
> if you have questions, I will try to find the time to help.
> Ayal


Interesting... Nice initiative!

The thing that I wonder is whether it would be possible to embed Yacas
at a lower level than via the parser. E.g. the Tcl embedding has
Tcl_EvalObjEx() and friends, which operate on preparsed Tcl objects.
Using this instead of Tcl_Eval() gives some efficiency gain, but more
importantly, it avoids the "quoting hell" associated with the
construction of the relevant command strings.

Since both R and Yacas are "Lisp under the hood" languages (and Tcl
too for that matter), it is a fairly good guess that their parse trees
are similar, and that it would be a fairly simple task to translate
back and forth between them. Well, between suitable subsets, at least.
R's parse trees can in principle contain arbitrary R objects, but in
this context, we might only need constants, names, operators, and
function calls.

It is probably not quite as easy as it sounds (is it ever?) but it
could be worth it anyway. The main thing that it would require is an
extended Yacas API which allows you to create Yacas objects from C
code.

-- 
   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
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-devel mailing list