Using function within expression

I have an elementary question. I would like to do this:

ex := A B;
asym(_, $A,B$);
Rule := {
x -> @(ex)
};

but without introducing ex as an intermediate. So something like:

Rule := {
x -> @asym($A B$, $A,B$)
};

I'm sure there must be a way to do it in Cadabra 2 but I cannot figure it out... Probably some python knowledge is needed!

+1 vote

Not possible at the moment. The @ operator which pulls a Python expression into a maths expression does not do any evaluation. It would be nice to be able to write

Rule := {
x -> @{ anything python that produces an Ex }
};

but at the moment that does not exist.