Efficient definition of function which uses fixed allocated constants

You can make the function global directly like this:

let A = [1,2,45,3]
    global g(x) = sum(x^a for a in A)
end
2 Likes