Using previously defined function as an argument


#1

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.


#2

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


#3

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


#4

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.