Thanks for this suggestion, Ben. I ultimately went with a combination of this
suggestion (dynamically determining associativity) and Ronald's suggestion
(allowing the user to choose). My parser will start with the associativity
used by NSExpression, but provides a property to change it.
Thank
Another option would be to make your code mimic whatever NSExpression is
doing on that machine, by evaluating 2 ** 3 ** 2 (once, and caching the result)
and seeing whether it comes out as 64 or 512. That way if/when Apple fixes
their bug, your code will seamlessly follow suit.
Which of the
I agree with you that exponentiation is usually defined as right-associative.
How about a compatibility switch in your code which you can flip to make it
work either way.
On 21-Nov-2010, at 11:25 AM, Dave DeLong wrote:
> Hi everyone,
>
> Let's say I have the string @"2 ** 3 ** 2". I can run
On 2009 May 22, at 13:54, Ben Trumbull wrote:
Uhm, No. %@ is the vararg specifier for an NSObject. -
stringWithFormat: turns that into a string. Because -
stringWithFormat: turns everything into a string. Kinda the point.
-predicateWithFormat: does NOT call -description randomly.
Pred
On 2009 May 17, at 15:10, Ben Trumbull wrote:
Core Data supports == and != searches against binary data. You
should be able to just use a predicate like:
[NSPredicate predicateWithFormat:@"myTransformableAttribute = %@",
myGuidObject]
and have it "just work".
Read the above carefully!
myGu
On Jun 28, 2008, at 11:35 PM, Chris wrote:
If anyone has a clue how to use it, I'd be grateful. This was my
unsuccessful attempt:
NSExpression * ex = [NSExpression expressionForFunction:
[NSExpression expressionForConstantValue:@"BAR"]
selectorName:@"length" arguments:nil];
NSPredicat
On Jun 28, 2008, at 10:35 PM, Chris wrote:
NSExpression * ex = [NSExpression expressionForFunction:
[NSExpression expressionForConstantValue:@"BAR"]
selectorName:@"length" arguments:nil];
NSPredicate * predicate = [NSCompoundPredicate
andPredicateWithSubpredicates:[NSArray arrayWithObject:
If anyone has a clue how to use it, I'd be grateful. This was my
unsuccessful attempt:
NSExpression * ex = [NSExpression expressionForFunction:[NSExpression
expressionForConstantValue:@"BAR"] selectorName:@"length"
arguments:nil];
NSPredicate * predicate = [NSCompoundPredicate
andPr
On Jun 28, 2008, at 12:13 AM, Chris <[EMAIL PROTECTED]> wrote:
NSExpression defines this method:
+ (NSExpression *)expressionForFunction:(NSString *)name arguments:
(NSArray *)parameters
and the doco provides this example:
[NSExpression expressionForFunction:(@selector(random))
arguments