             switch operation {
             case .Constant(let value) :
                 accumulator = value
+                rememberPendingIsNill()
             case .UnariOperation(let function) :
                 accumulator = function(accumulator)
+                rememberPendingIsNill()
             case .BinaryOperation(let function) :
                 executePendingBinaryOperation()
                 pending = pendingBinaryOperationInfo(binaryFunction: function,firstOperand: accumulator)
+                rememberPendingIsNill()
             case .Equals :
+                equals()
                 executePendingBinaryOperation()
             case .Delete :
                 accumulator = 0.0
                 pending = nil
+                rememberPendingIsNill()
             }
         }
+    }
+    
+    func equals() {
+        if rememberPending != nil{
+            accumulator = rememberPending!.binaryFunction(accumulator,rememberPending!.firstOperand)
+        }
+    }
+    
+    func rememberPendingIsNill() {
+        rememberPending = nil
     }
     
     var result : Double {

//

import Foundation


class CalculatorBrain {
    

    
    private func executePendingBinaryOperation() {
        if pending != nil {
            rememberPending = pendingBinaryOperationInfo(binaryFunction : pending!.binaryFunction, firstOperand : accumulator)
            accumulator = pending!.binaryFunction(pending!.firstOperand,accumulator)
            pending = nil
        }
