I have a function that depends on two integer parameters. It currently returns a function, but extensions would likely return objects whose dimensions depended on the input parameters. Naive implementation:

```
using SpecialFunctions
function tps_basis_eta(m::T, d::T) where {T <: Integer}
@assert 2m>d "Too many dimensions for degrees of smoothness"
if iseven(d)
r -> (-1)^(m+1+d/2)*r^(2m-d)*log(r)/
(2^(2m-1) * π^(d/2) * factorial(m-1) * factorial(m-d/2))
else
r -> gamma(d/2 - m) * r^(2m-d)/
(2^(2m) * π^(d/2) * factorial(m-1))
end
end
eta1 = tps_basis_eta(2, 1)
```

Looking at `Interpolations`

I see a different style, in which most of the defining characteristics are expressed as types. And even things which seem as if they might use value types, like the degree of the polynomial, are expressed as named types, e.g., `Quartic`

, `Cubic`

. So I’m wondering if I should be doing the same.

If I started to return, say, an m x d matrix, then I think type stability might be an issue too–although maybe not if the matrix were always 2 dimensional?

Finally, the inner functions have a lot of quantities that only need be computed once, when they are created. Do I need to pull them out explcitly, or is the compiler smart enough to do that? Or perhaps it would not because m and d are from some outer scope and might change?

P.S. I take it julia does not have postfix operators so that I can’t write n! for factorial(n).