code: func rewriteDynamics(f *equalityFactory, body Body) Body {
  	cpy := Body{}
  	for _, expr := range body {
  		var exprs []*Expr
  		switch expr.Terms.(type) {
  		case []*Term:
  			if expr.IsEquality() {
  				exprs = rewriteDynamicsEqExpr(f, expr)
  			} else {
  				exprs = rewriteDynamicsCallExpr(f, expr)
  			}
  		case *Term:
  			exprs = rewriteDynamicsTermExpr(f, expr)
  		}
  		for _, expr := range exprs {
  			cpy.Append(expr)
  		}
  	}
  	return cpy
  }
docs: // rewriteDynamics will rewrite the body so that dynamic terms (i.e., refs and
  // comprehensions) are bound to vars earlier in the query. This translation
  // results in eager evaluation.
  //
  // For instance, given the following query:
  //
  // foo(data.bar) = 1
  //
  // The rewritten vresion will be:
  //
  // __local0__ = data.bar; foo(__local0__) = 1