code: func rewriteComprehensionTerms(f *equalityFactory, node interface{}) (interface{}, error) {
  	return TransformComprehensions(node, func(x interface{}) (Value, error) {
  		switch x := x.(type) {
  		case *ArrayComprehension:
  			if requiresEval(x.Term) {
  				expr := f.Generate(x.Term)
  				x.Term = expr.Operand(0)
  				x.Body.Append(expr)
  			}
  			return x, nil
  		case *SetComprehension:
  			if requiresEval(x.Term) {
  				expr := f.Generate(x.Term)
  				x.Term = expr.Operand(0)
  				x.Body.Append(expr)
  			}
  			return x, nil
  		case *ObjectComprehension:
  			if requiresEval(x.Key) {
  				expr := f.Generate(x.Key)
  				x.Key = expr.Operand(0)
  				x.Body.Append(expr)
  			}
  			if requiresEval(x.Value) {
  				expr := f.Generate(x.Value)
  				x.Value = expr.Operand(0)
  				x.Body.Append(expr)
  			}
  			return x, nil
  		}
  		panic("illegal type")
  	})
  }
docs: // rewriteComprehensionTerms will rewrite comprehensions so that the term part
  // is bound to a variable in the body. This allows any type of term to be used
  // in the term part (even if the term requires evaluation.)
  //
  // For instance, given the following comprehension:
  //
  // [x[0] | x = y[_]; y = [1,2,3]]
  //
  // The comprehension would be rewritten as:
  //
  // [__local0__ | x = y[_]; y = [1,2,3]; __local0__ = x[0]]