diff options
Diffstat (limited to '')
-rw-r--r-- | polymatrix/expression/init.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/polymatrix/expression/init.py b/polymatrix/expression/init.py index 1e5baab..bb3da9a 100644 --- a/polymatrix/expression/init.py +++ b/polymatrix/expression/init.py @@ -157,6 +157,10 @@ def init_from_sympy_expr(data: sympy.Expr | sympy.Matrix | tuple[tuple[sympy.Exp return polymatrix.expression.impl.FromSympyExprImpl(data=data) +def init_from_statemonad(monad: StateMonad): + return polymatrix.expression.impl.FromStateMonadImpl(monad=monad) + + # NP: this function should be split up into smaller functions, one for each "from" type # NP: and each "from" should be documented, explaining how it is interpreted. def init_from_expr_or_none( @@ -177,8 +181,7 @@ def init_from_expr_or_none( return init_from_numbers_expr(wrapped) elif isinstance(data, StateMonad): - # FIXME: typing - return data.flat_map(lambda inner_data: init_from_expr_or_none(inner_data)) + return init_from_statemonad(data) elif isinstance(data, np.ndarray): return init_from_numpy_expr(data) |