Hi Thorsten,

> 2. there are many functions in R that look like this:
> ,--------------------------------
> | SEXP Invtrans(SEXP pG, SEXP x);
> `--------------------------------
> taking two lists, returning one list?

I don't know the R data structures, but I would say that you should be
able to do with 'native' almost anything you can do from the C API.

If 'SEXP' is just a pointer to an opaque data structure, there is not
much to worry about.

On the other hand, if you need to access the internals of such objects,
you might need to operate with the 'struct' funcion on them. In that
case you need to study the C include files and understand the layout of
these structures.

> 3. what about the many functions of R written in R itself, e.g.
> ,---------------------------------------------------------------
> | mean.default <- function(x, trim = 0, na.rm = FALSE, ...){}
> `---------------------------------------------------------------

I'm not sure. Then we would need some C-interface to the R runtime
system (interpreter?), and ways to represent R code in C structures.

> There is a system of generic functions a bit similar to the CLOS system
> (dispatching on all arguments). Can these functions be called via
> 'native'?

I would think so, as long as they are callable from C. 'native' is not
more than a mechanism to call C code.

I would recommend to first write some simple programs in C, to get a
feeling about what needs to be done. Then 'native' can be used to do the
same from PicoLisp.

Calling a C library with 'native' without a good understanding what that
library requires will almost certainly crash the system. For example,
what is the exact format of arguments and return values? Who "owns" the
data, i.e. is it necessary to allocate and free memory, or do the
library functions return pointers to static memory etc.

- Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to