diff options
author | Matthias Benkard <mulk@minimulk.mst-plus> | 2008-07-06 23:53:04 +0200 |
---|---|---|
committer | Matthias Benkard <mulk@minimulk.mst-plus> | 2008-07-06 23:53:04 +0200 |
commit | 26a11662d6d371a1d0c44de6bb028a1523ba4dc5 (patch) | |
tree | 9532f796a01ba5b3000d3e5bd6062c59f2a934b6 /MLKRoot.m | |
parent | bb79a71e7aa85536d3d60d50913d5fc39c4ac07b (diff) |
Add class MLKNumber, unify arithmetic interface.
Diffstat (limited to 'MLKRoot.m')
-rw-r--r-- | MLKRoot.m | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -19,6 +19,7 @@ #import "MLKCons.h" #import "MLKDynamicContext.h" #import "MLKInterpreter.h" +#import "MLKNumber.h" #import "MLKPackage.h" #import "MLKRoot.h" #import "MLKStream.h" @@ -195,22 +196,22 @@ static id truify (BOOL value) +(NSArray *) add:(NSArray *)args { - RETURN_VALUE ([[args objectAtIndex:0] add:[args objectAtIndex:1]]); + RETURN_VALUE ([((MLKNumber*)[args objectAtIndex:0]) add:[args objectAtIndex:1]]); } +(NSArray *) subtract:(NSArray *)args { - RETURN_VALUE ([[args objectAtIndex:0] subtract:[args objectAtIndex:1]]); + RETURN_VALUE ([((MLKNumber*)[args objectAtIndex:0]) subtract:[args objectAtIndex:1]]); } +(NSArray *) multiply:(NSArray *)args { - RETURN_VALUE ([[args objectAtIndex:0] multiplyWith:[args objectAtIndex:1]]); + RETURN_VALUE ([((MLKNumber*)[args objectAtIndex:0]) multiplyWith:[args objectAtIndex:1]]); } +(NSArray *) divide:(NSArray *)args { - RETURN_VALUE ([[args objectAtIndex:0] divideBy:[args objectAtIndex:1]]); + RETURN_VALUE ([((MLKNumber*)[args objectAtIndex:0]) divideBy:[args objectAtIndex:1]]); } +(NSArray *) list:(NSArray *)args |