From 07df35f1160f6a9ab1f117d8f134cab5925f3b15 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Fri, 27 Jun 2008 15:07:52 +0200 Subject: MLKInterpreter: Implement the VALUES operator. --- MLKInterpreter.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'MLKInterpreter.m') 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]) -- cgit v1.2.3