How can I automate the execution of a series of functions (with the names “test_1”, “test_2“, … “test_100”) using metaprogramming in DolphinDB?
For example:
def test_2(){
return 1
}
eval(<test_2()>)//output: 1
I want to use a loop to generate the function names as strings and pass them to eval
for execution. But when I passed the function name as a string to eval
, the result is not what I wanted:
eval(<'test_2()'>)//output: test_2()