Question: Array of functions

Hey altogether,

how can I solve the following problem:

for i from 1 to n do f_i := x -> i; od;

In this case f_1(x) should return 1, f_2(x) should return 2, and so on? The code above is not working because the right-hand side is not evaluated. Even trying eval/unapply/.. didn't help.

Thanks for your response,
Stefan

Please Wait...