[Rd] structure of SYMSXP values.

Guillaume Yziquel guillaume.yziquel at citycable.ch
Fri Nov 20 07:59:46 CET 2009


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/



More information about the R-devel mailing list