[graalvm-users] Interop from R to Ruby

Rodrigo Botafogo rodrigo.a.botafogo at gmail.com
Tue Aug 21 10:56:21 PDT 2018


Hello…

I’ve being accessing R from Ruby with success with calls to Polyglot.eval.
like:

func = Polyglot.eval(“R”, “c”).call(1, 2, 3)

I’m now trying to do a callback from R to Ruby. I’ve tried something like:

class Callback

  def f(x, y)
    Math.cos(y) / (1 + x^2)
  end

end

remote = Polyglot.eval("R", <<-R)
function(rb_method) {
   rb_method.call(1, 2)
 }
R

remote.call(Callback.new.method(:f))

But this doesn’t work. Is there an easy way of making this callback? And
what about sending an instance of a class instead of a function?

Thanks
-- 
Rodrigo Botafogo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/graalvm-users/attachments/20180821/9f5c1238/attachment.html 


More information about the GraalVM-Users mailing list