Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).

2021-04-08 Thread Alexander Burger
Hi Thorsten, > Question on topic 2: > given the C data type described below for an R "node", would it be somehow > possible to extract just the SEXPTYPE from a SEXP return value, i.e. > the first field of the sexpinfo_struct, that is the first struct in the > SEXPREC_

Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).

2021-04-08 Thread Thorsten Jolitz
: > >> Hi Alex, >> after digging deeper in R Internals I found out that there are actually C >> access functions for the various subtypes of SEXP that can be wrapped with >> native too: >> >> rinc: (setupRinC) >> -> NIL >> rinc: (evalQuietlyInR &

Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).

2021-04-08 Thread Cesar Rabak
ging deeper in R Internals I found out that there are actually C > access functions for the various subtypes of SEXP that can be wrapped with > native too: > > rinc: (setupRinC) > -> NIL > rinc: (evalQuietlyInR "V <- c(1.5, 3.4, 4.2)") > -> NIL > rinc: (evalIn

Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).

2021-04-08 Thread Thorsten Jolitz
Hi Alex, after digging deeper in R Internals I found out that there are actually C access functions for the various subtypes of SEXP that can be wrapped with native too: rinc: (setupRinC) -> NIL rinc: (evalQuietlyInR "V <- c(1.5, 3.4, 4.2)") -> NIL rinc: (evalInR "V&q

Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).

2021-04-07 Thread Alexander Burger
On Wed, Apr 07, 2021 at 07:46:20AM +0200, Alexander Burger wrote: > OK, so now we have a pointer to a structure filled by evalInR(). > ... >(struct (evalInR "6*4") ...) In fact this depends on what exactly evalInR() returns. If it returns a pointer to a dynamically allocated structure, and

Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).

2021-04-06 Thread Alexander Burger
Hi Thorsten, > (de evalInR ("Cmd") > (native `*RinC "evalInR" 'P "Cmd")) > > ## SEXP evalInR(char * cmd); > > rinc: (evalInR "print(6*4)") > [1] 24 > -> 65814160 OK, so now we have a pointer to a structure filled b

Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).

2021-04-06 Thread Thorsten Jolitz
M Thorsten Jolitz wrote: > >> Hello List, >> I wonder how to deal with the R SEXP Data structure in native calls. >> >> *"Technically, [a SEXP] is a pointer to a structure with typedef SEXPREC

Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).

2021-04-06 Thread Thorsten Jolitz
Hi Alex, thanks for the hints, I tried both, T and 'P as result values , the first gives a segment fault, but the second actually works: (de evalInR ("Cmd") (native `*RinC "evalInR" 'P "Cmd")) ## SEXP evalInR(char * cmd); rinc: (evalInR "print(6*4)&qu

Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).

2021-04-06 Thread Cesar Rabak
available through the API, in case of R a process similar to FFI using as reference the include files, wouldn't? HTH -- Cesar Rabak On Mon, Apr 5, 2021 at 4:30 PM Thorsten Jolitz wrote: > Hello List, > I wonder how to deal with the R SEXP Data structure in native calls. > >

Re: Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).

2021-04-06 Thread Alexander Burger
Hi Thorsten, > I wonder how to deal with the R SEXP Data structure in native calls. > > *"Technically, [a SEXP] is a pointer to a structure with typedef SEXPREC. > A SEXP is a variant type, with subtypes for all R’s data structures"* > > E.g. > >- IN

Native Calls with SEXP (a variant type, with subtypes for all R’s data structures).

2021-04-05 Thread Thorsten Jolitz
Hello List, I wonder how to deal with the R SEXP Data structure in native calls. *"Technically, [a SEXP] is a pointer to a structure with typedef SEXPREC. A SEXP is a variant type, with subtypes for all R’s data structures"* E.g. - INTSXP: integer vector - LGLSXP: logi

Re: SEXP?

2013-07-01 Thread Thorsten Jolitz
Alexander Burger a...@software-lab.de writes: Hi Alex, I wonder if there is a way in PicoLisp to check if some function argument is a SEXP, i.e. if something like a function 'sexp? exists that returns T if the argument is a SEXP. I'm a bit puzzled by this question. To my understanding

Re: SEXP?

2013-07-01 Thread Alexander Burger
Hi Thorsten, I'm a bit puzzled by this question. To my understanding, every possible expression in PicoLisp is a SEXP. Even auto-quoting expressions like ... .. and was a bit confused when asking, I probably meant 'list' instead of SEXP. ... then invalid file names fall into category

Re: SEXP?

2013-07-01 Thread dexen deVries
On Monday 01 of July 2013 07:39:49 you wrote: Hi Thorsten, I wonder if there is a way in PicoLisp to check if some function argument is a SEXP, i.e. if something like a function 'sexp? exists that returns T if the argument is a SEXP. how about (pair 'any) ? basically the opposite

Re: SEXP?

2013-07-01 Thread Thorsten Jolitz
dexen deVries dexen.devr...@gmail.com writes: On Monday 01 of July 2013 07:39:49 you wrote: Hi Thorsten, I wonder if there is a way in PicoLisp to check if some function argument is a SEXP, i.e. if something like a function 'sexp? exists that returns T if the argument is a SEXP. how

Re: SEXP?

2013-07-01 Thread Joe Bogner
function argument is a SEXP, i.e. if something like a function 'sexp? exists that returns T if the argument is a SEXP. how about (pair 'any) ? basically the opposite of (atom 'any) thats probably what I was looking for, thanks, besides the fact that Alex is of course right about

Re: SEXP?

2013-07-01 Thread Thorsten Jolitz
to check if some function argument is a SEXP, i.e. if something like a function 'sexp? exists that returns T if the argument is a SEXP. how about (pair 'any) ? basically the opposite of (atom 'any) thats probably what I was looking for, thanks

SEXP?

2013-06-30 Thread Thorsten Jolitz
Hi List, I wonder if there is a way in PicoLisp to check if some function argument is a SEXP, i.e. if something like a function 'sexp? exists that returns T if the argument is a SEXP. To complicate things a bit, I would actually need to check in PicoLisp if the argument given is an Emacs Lisp