The whole point of this macro is to inline the evaluation of a polynomial whose degree (and usually its coefficients) is known at compile time. This allows things like polynomial approximations of special-function implementations to be extremely efficient. Hence, the arguments must be an explicit list of coefficients.

(The case of a single coefficient, i.e. a degree-0 polynomial, is so pointless that we never implemented it. i.e. you might as well just write `1`

instead of `@evalpoly 3.0 1`

. We might as well implement it for completeness, I suppose.)

So, for example, if you knew that `p`

was an array of length 4, you could do:

```
julia> f(p) = @evalpoly(1, p[1], p[2], p[3], p[4])
f (generic function with 1 method)
julia> f([2,3,4,5])
14
```

In practice, `@evalpoly`

is mainly used in cases where the coefficients are compile-time constants as well, mainly in the implementation of special functions like `erfinv`

and `polygamma`

.

If you have an array `p`

whose length is not known, there is no point in using a macro to evaluate the polynomial. It will need an explicit loop that is evaluated at runtime, rather than at compile-time as in `@evalpoly`

.

At one point, I suggested that we have an `evalpoly`

function for runtime evaluation of polynomials (https://github.com/JuliaLang/julia/pull/7186), but there wasn’t much interest. In most such cases you probably want to use the Polynomials.jl package.