concepts.dm.crow.crow_expression_utils.crow_flatten_expression#

crow_flatten_expression(expr, mappings=None, ctx=None, deep=True, flatten_cacheable_expression=True)[source]#

Flatten an expression by replacing certain variables or function applications with sub-expressions. The input mapping is a dictionary of {expression: sub-expression}. There are two cases:

  • The expression is a VariableExpression, and the sub-expression is a

    Variable or a ValueOutputExpression. In this case, the variable expression will is the sub-expression used for replacing the variable.

  • The expression is a FunctionApplicationExpression, and the sub-expression is a

    Variable. Here, the function application expression must be a “simple” function application expression, i.e., it contains only variables as arguments. The Variable will replace the entire function application expression.

Parameters:
Returns:

the flattened expression.

Return type:

ObjectOrValueOutputExpression | VariableAssignmentExpression