[Rd] structure of SYMSXP values.

From: Guillaume Yziquel <guillaume.yziquel_at_citycable.ch>
Date: Fri, 20 Nov 2009 07:59:46 +0100


Hello.

I've now added some support to OCaml-R in order to investigate low-level structures. See below for an output, concerning 'str'.

But I'm having an issue concerning SEXPs with type SYMSXP.

> lazy
> {content =
> SYMSXP
> {pname = lazy {content = NILSXP};
> sym_value =
> lazy
> {content =
> SYMSXP
> {pname = lazy {content = NILSXP};
> sym_value =
> lazy
> {content =
> SYMSXP
> {pname = <lazy>; sym_value = <lazy>; internal = <lazy>}};
> internal = lazy {content = NILSXP}}};
> internal = lazy {content = NILSXP}}};

It seems that the sym_value of a SYMSXP is a SYMSXP. But apparently they seem to be different structures, as the pointers pointing to these structures (the parent SYMSXP and the child SYMSXP) give different addresses...

So I'm wondering: what's the structure of SYMSXPs? Is its sym_value always a SYMSXP? I guess not. When its sym_value is a SYMSXP, is it pointing to itself?

All the best,

Guillaume Yziquel.

> # t;;
> - : R.Internal.t = <lazy>
> # unfold 1 t;;
> - : unit = ()
> # t;;
> - : R.Internal.t =
> lazy {content = PROMSXP {prom_value = <lazy>; expr = <lazy>; env = <lazy>}}
> # unfold 2 t;;
> - : unit = ()
> # t;;
> - : R.Internal.t =
> lazy
>  {content =
>    PROMSXP
>     {prom_value =

> lazy
> {content =
> SYMSXP {pname = <lazy>; sym_value = <lazy>; internal = <lazy>}};
> expr =
> lazy
> {content = LANGSXP {carval = <lazy>; cdrval = <lazy>; tagval = <lazy>}};
> env = lazy {content = ENVSXP}}} > # unfold 3 t;; > - : unit = () > # t;; > - : R.Internal.t = > lazy > {content = > PROMSXP > {prom_value =
> lazy
> {content =
> SYMSXP
> {pname = lazy {content = NILSXP};
> sym_value =
> lazy
> {content =
> SYMSXP {pname = <lazy>; sym_value = <lazy>; internal = <lazy>}};
> internal = lazy {content = NILSXP}}};
> expr =
> lazy
> {content =
> LANGSXP
> {carval =
> lazy
> {content =
> SYMSXP {pname = <lazy>; sym_value = <lazy>; internal = <lazy>}};
> cdrval =
> lazy
> {content =
> LISTSXP {carval = <lazy>; cdrval = <lazy>; tagval = <lazy>}};
> tagval = lazy {content = NILSXP}}};
> env = lazy {content = ENVSXP}}} > # unfold 4 t;; > - : unit = () > # t;; > - : R.Internal.t = > lazy > {content = > PROMSXP > {prom_value =
> lazy
> {content =
> SYMSXP
> {pname = lazy {content = NILSXP};
> sym_value =
> lazy
> {content =
> SYMSXP
> {pname = lazy {content = NILSXP};
> sym_value =
> lazy
> {content =
> SYMSXP
> {pname = <lazy>; sym_value = <lazy>; internal = <lazy>}};
> internal = lazy {content = NILSXP}}};
> internal = lazy {content = NILSXP}}};
> expr =
> lazy
> {content =
> LANGSXP
> {carval =
> lazy
> {content =
> SYMSXP
> {pname = lazy {content = CHARSXP};
> sym_value = lazy {content = BUILTINSXP};
> internal = lazy {content = NILSXP}}};
> cdrval =
> lazy
> {content =
> LISTSXP
> {carval = lazy {content = INTSXP};
> cdrval =
> lazy
> {content =
> LISTSXP
> {carval = <lazy>; cdrval = <lazy>; tagval = <lazy>}};
> tagval = lazy {content = NILSXP}}};
> tagval = lazy {content = NILSXP}}};
> env = lazy {content = ENVSXP}}} -- Guillaume Yziquel http://yziquel.homelinux.org/ ______________________________________________ R-devel_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri 20 Nov 2009 - 07:03:20 GMT

This archive was generated by hypermail 2.2.0 : Fri 20 Nov 2009 - 09:00:34 GMT