I need to compile a function `g`

that calls an external function `f`

. `f`

and `g`

are defined as such:

```
r = {0,0,1};
f = # - r &;
g = Compile[{{a, _Real}}, f[a], CompilationOptions -> {"InlineExternalDefinitions" -> True}]
```

But this way `r`

will be held, and `g`

will assume it to be a real number instead of a vector, throwing type error when trying to find `a - r`

. How can I inline `r`

such that `f = # - {0,0,1}&`

? `Evaluate`

doesn’t work because the result will be `f = {#, #, #-1}&`

.