From p.dalgaard at biostat.ku.dk  Sun Jul 17 14:55:38 2005
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: 17 Jul 2005 14:55:38 +0200
Subject: [Rd] Computer algebra in R - would that be an idea??
In-Reply-To: <670D7252-4A25-4179-AA28-D6974AE9904A@xs4all.nl>
References: <C83C5E3DEEE97E498B74729A33F6EAEC01AD9A2B@DJFPOST01.djf.agrsci.dk>
	<1121429806.42d7a92eb6678@horde.scannet.dk>
	<17111.46789.226240.355911@stat.math.ethz.ch>
	<a06110400befe1c42c158@203.61.56.151>
	<971536df050716033614fd6e77@mail.gmail.com>
	<a06110401beffa70234a8@[10.1.1.4]>
	<670D7252-4A25-4179-AA28-D6974AE9904A@xs4all.nl>
Message-ID: <x2zmslk2wl.fsf@turmalin.kubism.ku.dk>

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



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