nmodl
nmodl copied to clipboard
Review `factorial`.
In nocmodl the string factorial is reserved for the function factorial and will refuse to compile. In NMODL, it seems to generate a user-specified and it doesn't not error out.
Valid:
NEURON {
SUFFIX recursion
}
FUNCTION myfactorial(n) {
myfactorial = factorial(n)
}
Invalid:
NEURON {
SUFFIX recursion
}
FUNCTION factorial(n) {
if (n == 0 || n == 1) {
factorial = 1
} else {
factorial = n * factorial(n - 1)
}
}
Yes. factorial is listed in nrn/src/nmodl/extedf.h as a supported function (from the scoop-math library)