I have an expression `e = :(x[3] ^ 2.0)`

that I hope to turn into a function which will evaluate `e`

at `x`

given arguments `e`

and `x`

. I tried the below but am messing something up.

```
function f(ex::Array{Float64,1}, expr::Expr)
[x[i] = eval(ex[i]) for i =1:length(ex)]
return eval(expr)
end
```

It differs slightly from this question because my input is an array which I’m not sure how to loop over (I also tried the following)

```
function g(x)
return :(x[3] ^ 2.0)
end
@eval function f(x)
$(g(x))
end
```