On Tuesday, 17 March 2015 at 21:00:11 UTC, bachmeier wrote:
What do you have in mind? I no longer work much with Python so my knowledge is limited, but calling D from R or Julia should be no different from calling C from those languages, as you normally compile your C code into a shared library anyway.

I've done the R->D thing many times and in the process have worked with a big chunk of the R API. Things like allocating R data structures from a D function, adding assertions to your D code to allow for an easy exit when things don't work out, and calling functions in the R math library, among other things, are not difficult.

(For work at least) I find myself in situations where I'm forced into using loops in R or Python. Sometimes the loops can be parallelized, but not always. Python is not good for parallelizing, and R is only good on a Linux machine (which I can't use at work). Both are bad when you really have to do a loop. Julia is better for that, but I can't get the package manager to work on my work computer because of a corporate firewall. Anyway, all the calculations I would be doing would involve matrix math/regressions/optimization, most of which could be done in C++ (so being able to call C++ libraries would go a long way).

I've looked at calling C code from R before and using Cython in Python. However, I think it's another step altogether to get an R library (like lme4) to work in a D program. I have zero idea how to go about doing that. It has seemed like a bit of a hassle for anything complex. For instance, suppose I wanted to create a loop in C that calls an R function from lme4 multiple times and then I wanted to call that C function from R. Makes my head hurt just thinking about it.

Nevertheless, I think that there would be a lot of value in writing up what you have done with R and D. That sounds very interesting.

Reply via email to