 internal typealias BinaryEvaluator = (_ operand1: Value, _ operand2: Value, _ context: EvaluateContext) -> Value
 fileprivate typealias UnaryEvaluator = (_ operand: Value, _ context: EvaluateContext) -> Value
 
-fileprivate func binaryOperator(_ evaluator: @escaping BinaryEvaluator) -> Function {
+fileprivate func binaryOperator(dereferencing: Bool, evaluator: @escaping BinaryEvaluator) -> Function {
     return { (parameters, context) in
         if parameters.count != 2 {
             return ErrorValue.invalidArgumentCount
         }
         
+        let toValue: (Expression) -> Value = (dereferencing)
+            ? { $0.evaluate(with: context).dereference(with: context) }
+            : { $0.evaluate(with: context) }
+        
         let expression1 = parameters[0]
-        let operand1 = expression1.evaluate(with: context)
+        let operand1 = toValue(expression1)
         if operand1 is ErrorableValue {
             return operand1
         }
         
         let expression2 = parameters[1]
-        let operand2 = expression2.evaluate(with: context)
+        let operand2 = toValue(expression2)
         if operand2 is ErrorableValue {
             return operand2
         }

}

fileprivate func comparisonOperator(matcher: @escaping (Int) -> Bool) -> Function {
    return binaryOperator(dereferencing(compareTwoValues(matcher: matcher)))
}

fileprivate let equalTo = comparisonOperator { $0 == 0 }

        return ErrorValue.nan
    }
    return DoubleValue(number: result)
}

fileprivate let unaryPlus = unaryOperator(dereferencing: true) { $0.0 }

fileprivate func unaryNegate(_ parameters: [Expression], _ context: EvaluateContext) -> Value {
    if parameters.count != 1 {
