Hi.

I’d like to know if there is a way to convert a function to a different form without the actual evaluation.

For example, I’m trying to make an API of DifferentialEquations.jl. However, I encountered a serious performance degradation. The following code is an example of my API.

```
function DifferentialEquations.ODEProblem(env::AbstractEnv, f, x0, tspan; kwargs...)
warn_is_registered(env)
_x0 = raw(env, x0)
_f(_x, p, t) = raw(env, f(readable(env, _x), p, t))
ODEProblem(_f, _x0, tspan; kwargs...)
end
```

In the above code, `x0`

denotes NamedTuple-valued (i.e., readable) initial condition.

`_x0`

is a vector-valued (i.e., raw) initial condition.

From this line, `_f(_x, p, t) = raw(env, f(readable(env, _x), p, t))`

, you may notice that the argument `f`

of the extended function `DifferentialEquations.ODEProblem(env::AbstractEnv, f, x0, tspan; kwargs...)`

will receive a “readable” state (`x`

) and provide a “readable” output of its derivative.

For the compatibility with DifferentialEquations.jl, `_f`

, which is the injected dynamical equations into `ODEProblem`

provided by DifferentialEquations.jl, should provide a “raw” output, so the output of `f(readable(env, _x), p, t)`

is wrapped by `raw`

.

In this case, I realised that every call of `_f`

would require two processings, `raw`

and `readable`

, which drastically degrade the performance. So, I wonder if there is a way of parsing the “readable” dynamical equations, `f`

, to the “raw” dynamical equations, `_f`

, at the beginning, not every time it is called.