@solve.implementation(for_type=ast.Sort)<EOL>def solve_sort(expr, vars):
lhs_values = repeated.getvalues(__solve_for_repeated(expr.lhs, vars)[<NUM_LIT:0>])<EOL>sort_expression = expr.rhs<EOL>def _key_func(x):<EOL><INDENT>return solve(sort_expression, __nest_scope(expr.lhs, vars, x)).value<EOL><DEDENT>results = ordered.ordered(lhs_values, key_func=_key_func)<EOL>return Result(repeated.meld(*results), ())<EOL>
Sort values on the LHS by the value they yield when passed to RHS.