diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-06-27 16:13:38 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-06-27 16:13:38 +0200 |
commit | 08e462e7a12530c2c7bb8036be05d79d1dfe9456 (patch) | |
tree | c138314fcc5cdc193ea7e5aa758b59bf6034781f /MLKInterpreter.m | |
parent | d8bb9ac98e86017217b3760d7b68d2be2b2d975d (diff) |
Add class MLKRoot.
Diffstat (limited to 'MLKInterpreter.m')
-rw-r--r-- | MLKInterpreter.m | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/MLKInterpreter.m b/MLKInterpreter.m index 49db342..35ea2ad 100644 --- a/MLKInterpreter.m +++ b/MLKInterpreter.m @@ -25,6 +25,7 @@ #import "MLKLexicalContext.h" #import "MLKLexicalEnvironment.h" #import "MLKPackage.h" +#import "MLKRoot.h" #import "MLKSymbol.h" #import "runtime-compatibility.h" @@ -376,10 +377,33 @@ static MLKSymbol *_LAMBDA; } else { - [NSException raise:@"MLKNoSuchOperatorException" - format:@"%@ does not name a known operator.", - [car descriptionForLisp]]; - return nil; + NSMutableArray *args = [NSMutableArray array]; + MLKCons *rest = [program cdr]; + NSArray *results; + + while (rest) + { + id result = [[self eval:[rest car] + inLexicalContext:context + withEnvironment:lexenv] + objectAtIndex:0]; + [args addObject:result]; + rest = [rest cdr]; + } + + results = [MLKRoot dispatch:car withArguments:args]; + + if (results) + { + return results; + } + else + { + [NSException raise:@"MLKNoSuchOperatorException" + format:@"%@ does not name a known operator.", + [car descriptionForLisp]]; + return nil; + } } } } |