This is an old version, view current version.

35.3 File extensions

The recommended file extension for Stan model files is .stan. Files which contain only function definitions (intended for use with #include) should be given the .stanfunctions extension. A .stanfunctions file only includes the function definition and does not require the functions{} block wrapped around the function. A simple example of usage where the function is defined and saved in the file foo.stanfunctions:

real foo(real x, real y) {
  return sqrt(x * log(y));
}

The function foo can be accessed in the Stan program by including the path to the foo.stanfunctions file as:

functions {
  #include foo.stanfunctions;
}
// ...body...

For Stan data dump files, the recommended extension is .R, or more informatively, .data.R. For JSON output, the recommended extension is .json.