Please note, this blog entry is from a previous course. You might want to check out the current one.
The evaluate() function should use a variable’s value (from the variableValues dictionary) whenever a variable is encountered or return nil if it encounters a variable with no corresponding value.
… which actually means just return the dictionary entry from the variable values:
private func evaluate(ops: [Op]) -> (result: Double?, remainingOps: [Op]) { ... case .Variable(let symbol): return (variableValues[symbol], remainingOps) ... }
Continue reading “cs193p – Project #2 Assignment #2 Task #6”