evalLet evaluates a let transform. This consists of a number of let statements, each acting on a single row.
( head ast.Atom, transform ast.Transform, rows []ast.ConstSubstList, emit func(atom ast.Atom) bool)
| 41 | // evalLet evaluates a let transform. This consists of a number of let statements, |
| 42 | // each acting on a single row. |
| 43 | func evalLet( |
| 44 | head ast.Atom, |
| 45 | transform ast.Transform, |
| 46 | rows []ast.ConstSubstList, |
| 47 | emit func(atom ast.Atom) bool) error { |
| 48 | for _, init := range rows { |
| 49 | subst := init |
| 50 | for _, stmt := range transform.Statements { |
| 51 | con, err := functional.EvalApplyFn(stmt.Fn, subst) |
| 52 | if err != nil { |
| 53 | return err |
| 54 | } |
| 55 | subst = subst.Extend(*stmt.Var, con) |
| 56 | } |
| 57 | emit(head.ApplySubst(subst).(ast.Atom)) |
| 58 | } |
| 59 | return nil |
| 60 | } |
| 61 | |
| 62 | type grouped struct { |
| 63 | key []ast.Constant |
no test coverage detected