Is there a way to programmaticaly declare a vector?

Let’s say i have a vector of n functions, can i instead of declaring the vector and typing the notation of each function inside the vector just write something like :
vec(f_i for i in range(n))

Hi and welcome to the forum :wave:

Do you mean something like this?

#let n = 8
$#math.vec(..range(n).map(i => $f_#i$))$

You can read more about spreading and mapping in the documentation. In general, functional programming is more suitable for situations like this. Since it looks like you come from an imperative perspective (for i in range(n)), have a look at this comparison.


On the meta side of things, for the benefit of other users who might have similar questions, please consider the following:

1 Like

No problem, you’re welcome.