Skip to content
Prev 16953 / 63424 Next

Computer algebra in R - would that be an idea??

Ayal Pinkus <apinkus at xs4all.nl> writes:
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.