Can I pass a `nimbleFunction` to another `nimbleFunction`?
My specific use case is that I would like to define my model to accept arbitrary kernel functions. Viz. I define many kernel `nimbleFunction`s, such as a Gaussian kernel, or a Matern kernel that conform to a particular interfaace, and then define additional `nimbleFunction`s that use those functions in the same way.
Here is my naive approach that doesn't work as hoped:
```
gpCov <- function(kernelFunc) {
nimbleFunction(
run = function(
dists = double(2),
rho = double(0),
sigma = double(0),
nugget = double(0)
) {
returnType(double(2))
ret <- sigma*sigma*kernelFunc(dists/(2*sqrt(rho)))
diag(ret) <- diag(ret) + nugget
return(ret)
})
}
```