As usual I'm having trouble with Eval and Expr.
I need to create an associative array where values would be evaluated results of some expressions.
For instance I need to create
aaa=[
"2x2" => 4
]
but 4 there is a result of evaluated expression Expr(2*2)
Lame variant that obviously doesn't work is here:
aaa=[
"2x2" => 2*2
]
But then I'll say that 2*2 is an Expr:
aaa=[
"2x2" => Expr(2*2)
]
and then I'll use Eval Expr to evaluate all expressions inside the argument and return expression with evaluated subexpressions:
Eval Expr(
aaa=[
"2x2" => Expr(2*2)
]
)
and it already doesn't work - it doesn't evaluate Expr(2*2)
The next step would be to evaluate resultant expression:
Eval(
Eval Expr(
aaa=[
"2x2" => Expr(2*2)
]
)
)
but obviously it doesn't work.
Why does it not work and what is the correct way?