This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Assignment 2, Problem 2 | |
| + (NSString *)descriptionOfProgram:(id)program | |
| { | |
| NSMutableArray *stack; | |
| if ([program isMemberOfClass:[NSArray class]]) | |
| { | |
| stack = [program mutableCopy]; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| + (double)runProgram:(id)program | |
| { | |
| NSMutableArray *stack; | |
| if ([program isKindOfClass:[NSArray class]]) { | |
| stack = [program mutableCopy]; | |
| } | |
| return [self popOperandOffProgramStack:stack]; | |
| } |
NewerOlder