Using a single function in multiple Stan programs

Is there a way to use a single function in multiple Stan programs? The idea would be that some stan function “foo” would be in a file “foo.stan” and this could be included in other Stan programs. This would be useful. Right now I’m using the same function in 2 different programs, and so every time I change the function for some reason, I have to change it in both programs, which is a recipe for trouble…!

2 Likes

I’m surprised that you didn’t know about this already: https://mc-stan.org/docs/2_20/reference-manual/includes-section.html

2 Likes

Thanks! My bad for not searching the manual for “include”.