Using previously defined function as an argument


Is it possible to use an user defined function as an argument for another function? I know that base stan functions such as integrate_ode_rk45 take the user defined ODE function as an argument. Not sure how to write similar function in Stan.


Edit: No (I misunderstood what you were asking at first).


That’s a shame. It would make lives easier if such functionality was available in stan.


You can do more or less the same thing if you #include your own C++ file in a Stan program. Just define your user-defined function in C++ and call it from your C++ function that you declare but don’t defined in your Stan program.