<div dir="ltr"><div><div><div>Hello Graalers...<br><br></div>I&#39;m trying to test and implement an integration between Ruby and R.  For that I have implemented this simple code where R.eval is a call to the R eval function.<br><br>    p R.eval(&quot;var = 4&quot;)<br>    p R.eval(&quot;print(var)&quot;)<br>    val = R.eval(&quot;var = 4&quot;)<br>    p val<br>    val = R.eval(&quot;var = c(1, 2, 3, 4)&quot;)<br>    p val<br>    p val[1]<br>    val = R.eval(&quot;list(1, 2, c(&#39;a&#39;, &#39;b&#39;, &#39;c&#39;))&quot;)<br>    p val<br>    p val[2][1]<br><br></div>I get the following results for this code:<br><br></div>4.0           # result of R.eval(&quot;var = 4&quot;)<br><div>[1] 4         # the print(var) in R<br></div><div>4.0           # result of R.eval(&quot;print(var)&quot;)<br></div><div>4.0           # p val<br></div><div>#&lt;Truffle::Interop::Foreign@46994f26&gt;  # pointer to the c(1, 2, 3, 4) op<br></div><div>2.0           # p val[1]<br></div><div>#&lt;Truffle::Interop::Foreign@2b8cf049&gt;  # pointer to the list<br>&quot;b&quot;           # p val[2][1]<br><br></div><div>My questions:<br><br></div><div>1) In R, if I&#39;m not mistaken print(var) has no return value.  Should we get 4.0 as return in this case?<br></div><div>2) The first pointer a foreign object points to a vector while the second pointer points to a list.  In this simple case, we know beforehand the type of the object, but in general this might not be true.  Is there any way to know the type of the object and to what messages it responds?  This seems critical to me to be able to really integrate both languages;<br></div><div>3) The result of R.eval(&quot;var = 4&quot;) in R is a vector, but we get back a float in Ruby.  For consistency, shouldn&#39;t this be a Ruby vector with 1 element? <br><br></div><div>Thanks<br></div><div><br><div><br clear="all"><div><div><br>-- <br><div class="gmail_signature">Rodrigo Botafogo<br><br></div>
</div></div></div></div></div>