diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-03 19:18:31 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-03 19:18:31 +0200 |
commit | 930a4cef72c1b3798edbd7f3a91ee79a5cbb14ad (patch) | |
tree | d8f8ea8b2394a639c610360ba5e4880f344a0b4c | |
parent | 92a3142b212589ff9da84347b72e679d0827efd7 (diff) |
Reimplement VALUES as a function as opposed to a special operator.
-rw-r--r-- | GNUmakefile | 3 | ||||
-rw-r--r-- | MLKInterpreter.m | 20 | ||||
-rw-r--r-- | MLKLexicalEnvironment.m | 4 |
3 files changed, 6 insertions, 21 deletions
diff --git a/GNUmakefile b/GNUmakefile index c069169..3a2dd9b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -46,7 +46,8 @@ ToiletKit_OBJC_FILES = MLKBackquoteReader.m MLKBinding.m MLKCharacter.m \ MLKStream.m MLKStringInputStream.m \ MLKStringOutputStream.m MLKStringReader.m \ MLKSymbol.m MLKThrowException.m \ - NSObject-MLKPrinting.m NSString-MLKPrinting.m + MLKValuesFunction.m NSObject-MLKPrinting.m \ + NSString-MLKPrinting.m ToiletKit_LDFLAGS = -lgmp #LIBRARIES_DEPEND_UPON diff --git a/MLKInterpreter.m b/MLKInterpreter.m index 4341e55..8b8600a 100644 --- a/MLKInterpreter.m +++ b/MLKInterpreter.m @@ -1204,26 +1204,6 @@ static MLKSymbol *MULTIPLE_VALUE_CALL; return results; } - 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 - expandOnly:expandOnly] - objectAtIndex:0]]; - } - - if (expandOnly) - RETURN_VALUE ([MLKCons cons:VALUES - with:[MLKCons listWithArray:results]]); - return results; - } else { if ([context symbolNamesFunction:car]) diff --git a/MLKLexicalEnvironment.m b/MLKLexicalEnvironment.m index c460111..4bcac78 100644 --- a/MLKLexicalEnvironment.m +++ b/MLKLexicalEnvironment.m @@ -33,6 +33,7 @@ #import "MLKReadtable.h" #import "MLKSymbol.h" #import "MLKInteger.h" +#import "MLKValuesFunction.h" #import "runtime-compatibility.h" @@ -59,6 +60,9 @@ static MLKLexicalEnvironment *global_environment; [vars setObject:[NSNull null] forKey:[NSNull null]]; [vars setObject:[cl intern:@"T"] forKey:[cl intern:@"T"]]; + [funs setObject:AUTORELEASE ([[MLKValuesFunction alloc] init]) + forKey:[cl intern:@"VALUES"]]; + global_environment = [[self alloc] initWithParent:nil variables:vars functions:funs]; |