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