diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-18 01:19:06 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-18 01:22:08 +0200 |
commit | bdfe4801295945b92f84b8c03cb2e0be485ae4f0 (patch) | |
tree | 4e3b51b3ad5269404a168fe10b9e3ffddcacb3d5 /MLKRoot.m | |
parent | ec1b0c41160ce153f3b2cd39ffeb2f4522fd1c38 (diff) |
Promote special operator APPLY to an intrinsic function.
Diffstat (limited to 'MLKRoot.m')
-rw-r--r-- | MLKRoot.m | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -711,11 +711,11 @@ as provided by method %@ of object %@", #ifdef USE_LLVM +(NSArray *) compile:(NSArray *)args { - NSLog (@"Compiling lambda form."); + //NSLog (@"Compiling lambda form."); id thing = [MLKLLVMCompiler compile:denullify([args objectAtIndex:0]) inContext:[MLKLexicalContext globalContext]]; - NSLog (@"Compilation done."); - NSLog (@"Compiled: %@", thing); + //NSLog (@"Compilation done."); + //NSLog (@"Compiled: %@", thing); RETURN_VALUE (thing); } #endif @@ -757,4 +757,20 @@ as provided by method %@ of object %@", RETURN_VALUE (value); } + ++(NSArray *) apply:(NSArray *)args +{ + id function = denullify ([args objectAtIndex:0]); + id arglist = denullify ([args objectAtIndex:1]); + + if (!function || [function isKindOfClass:[MLKSymbol class]]) + { + function = [[MLKLexicalEnvironment globalEnvironment] + functionForSymbol:function]; + } + + return [function applyToArray:(arglist + ? (id)[arglist array] + : (id)[NSArray array])]; +} @end |