What would be the best way to code this efficiently cause this is going to get called recursively, and creating alot of objects is no good. +*-/, sin,cos,sqrt,pi and x,y,a,b
should be put together in three separate if statements
unlike now where everything is seperated. Also for readability making a if statments that contains 4 isEqualToString
is not very good.
NSString *operation = topOfStack;
if ([operation isEqualToString:@"+"]) {
} else if ([@"*" isEqualToString:operation]) {
} else if ([operation isEqualToString:@"-"]) {
} else if ([operation isEqualToString:@"/"]) {
} else if ([operation isEqualToString:@"sin"]) {
} else if ([operation isEqualToString:@"cos"]) {
} else if ([operation isEqualToString:@"sqrt"]) {
} else if ([operation isEqualToString:@"pi"]) {
} else if ([operation isEqualToString:@"x"]) {
} else if ([operation isEqualToString:@"y"]) {
} else if ([operation isEqualToString:@"a"]) {
} else if ([operation isEqualToString:@"b"]) {
}