diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-06-27 15:07:52 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-06-27 15:07:52 +0200 |
commit | 07df35f1160f6a9ab1f117d8f134cab5925f3b15 (patch) | |
tree | 1025508ff6760af73c08b6e97a2f795d02a64865 | |
parent | efad95ec36837acdcc1aa4012675aabf0b72c756 (diff) |
MLKInterpreter: Implement the VALUES operator.
-rw-r--r-- | MLKInterpreter.m | 18 | ||||
-rw-r--r-- | MLKPackage.m | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/MLKInterpreter.m b/MLKInterpreter.m index 0b50312..49db342 100644 --- a/MLKInterpreter.m +++ b/MLKInterpreter.m @@ -68,6 +68,7 @@ static MLKSymbol *EVAL; static MLKSymbol *QUOTE; static MLKSymbol *SETQ; static MLKSymbol *PROGV; +static MLKSymbol *VALUES; static MLKSymbol *_DEFMACRO; static MLKSymbol *_LAMBDA; @@ -92,6 +93,7 @@ static MLKSymbol *_LAMBDA; QUOTE = [cl intern:@"QUOTE"]; SETQ = [cl intern:@"SETQ"]; PROGV = [cl intern:@"PROGV"]; + VALUES = [cl intern:@"VALUES"]; _DEFMACRO = [sys intern:@"%DEFMACRO"]; _LAMBDA = [sys intern:@"%LAMBDA"]; } @@ -326,6 +328,22 @@ static MLKSymbol *_LAMBDA; { //FIXME: ... } + else if (car == VALUES) + { + id results = [NSMutableArray array]; + id rest = program; + + while ((rest = [rest cdr])) + { + [results addObject: + [[self eval:[rest car] + inLexicalContext:context + withEnvironment:lexenv] + objectAtIndex:0]]; + } + + return results; + } else { if ([context symbolNamesFunction:car]) diff --git a/MLKPackage.m b/MLKPackage.m index 4060e81..b8370c4 100644 --- a/MLKPackage.m +++ b/MLKPackage.m @@ -71,6 +71,8 @@ static NSMutableDictionary *packages = nil; [cl export:[cl intern:@"SETQ"]]; [cl export:[cl intern:@"DECLARE"]]; [cl export:[cl intern:@"QUOTE"]]; + [cl export:[cl intern:@"VALUES"]]; + [cl export:[cl intern:@"EVAL"]]; [sys export:[sys intern:@"%DEFMACRO"]]; [sys export:[sys intern:@"%LAMBDA"]]; |