summaryrefslogtreecommitdiff
path: root/MLKRoot.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-18 01:19:06 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-18 01:22:08 +0200
commitbdfe4801295945b92f84b8c03cb2e0be485ae4f0 (patch)
tree4e3b51b3ad5269404a168fe10b9e3ffddcacb3d5 /MLKRoot.m
parentec1b0c41160ce153f3b2cd39ffeb2f4522fd1c38 (diff)
Promote special operator APPLY to an intrinsic function.
Diffstat (limited to 'MLKRoot.m')
-rw-r--r--MLKRoot.m22
1 files changed, 19 insertions, 3 deletions
diff --git a/MLKRoot.m b/MLKRoot.m
index b12cd17..0db7483 100644
--- a/MLKRoot.m
+++ b/MLKRoot.m
@@ -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