Please note, this blog entry is from a previous course. You might want to check out the current one.
Make your description have as few parentheses as possible for binary operations.
Add a new computed variable to the Op enum, which returns by the default the maximum integer value and for binary operations the value you set when defining the operation:
private enum Op: Printable { ... case BinaryOperation(String, Int, (Double, Double) -> Double) ... var precedence: Int { get { switch self { case .BinaryOperation(_, let precedence, _): return precedence default: return Int.max } } } }
Continue reading “cs193p – Project #2 Assignment #2 Extra Task #1”