Function mz_expr::scalar::reduce_list_create_list_index_literal
source · fn reduce_list_create_list_index_literal(
list_create_to_reduce: MirScalarExpr,
index_exprs: Vec<MirScalarExpr>
) -> MirScalarExpr
Expand description
Partial-evaluates a list indexing with a literal directly after a list creation.
Multi-dimensional lists are handled by a single call to this function, with multiple elements in index_exprs (of which not all need to be literals), and nested ListCreates in list_create_to_reduce.
Examples
LIST[f1,f2][2]
–> f2
.
A multi-dimensional list, with only some of the indexes being literals:
LIST[[[f1, f2], [f3, f4]], [[f5, f6], [f7, f8]]] [2][n][2]
–> LIST[f6, f8] [n]
See more examples in list.slt.