diff options
author | Matthias Benkard <mulk@minimulk.mst-plus> | 2008-07-27 09:44:01 +0200 |
---|---|---|
committer | Matthias Benkard <mulk@minimulk.mst-plus> | 2008-07-27 09:44:01 +0200 |
commit | a234e03248b1a8a97ee5f0b1d3a8f988d275cea8 (patch) | |
tree | aa7ebafc37ced87a96855b9758310dd80c84d2fc /MLKRoot.m | |
parent | 39c7ec616a22882c2b98244c7dcb39b6cd8ef122 (diff) | |
parent | bcde0dca1696a9f9e754d52776700edc83663453 (diff) |
Merge branch 'master' of http://matthias.benkard.de/code/mulklisp
Diffstat (limited to 'MLKRoot.m')
-rw-r--r-- | MLKRoot.m | 29 |
1 files changed, 27 insertions, 2 deletions
@@ -225,10 +225,12 @@ static id truify (BOOL value) +(NSArray *) macroexpand_1:(NSArray *)args { id form = [args objectAtIndex:0]; - id env = [args count] > 1 ? [args objectAtIndex:1] : nil; + id env = [args count] > 1 ? denullify([args objectAtIndex:1]) : nil; MLKLexicalContext *context = env ? (id)env : (id)[MLKLexicalContext globalContext]; - if ([context symbolNamesMacro:[form car]]) + if ([form isKindOfClass:[MLKCons class]] + && (![form car] || [[form car] isKindOfClass:[MLKSymbol class]]) + && [context symbolNamesMacro:[form car]]) { id <MLKFuncallable> macrofun = [context macroForSymbol:[form car]]; form = denullify ([[macrofun applyToArray: @@ -409,4 +411,27 @@ static id truify (BOOL value) RETURN_VALUE ([cl intern:@"T"]); } + ++(NSArray *) objc_class_of:(NSArray *)args +{ + RETURN_VALUE ([[args objectAtIndex:0] class]); +} + ++(NSArray *) objc_subclassp:(NSArray *)args +{ + RETURN_VALUE (truify ([[args objectAtIndex:0] isSubclassOfClass: + [args objectAtIndex:1]])); +} + ++(NSArray *) find_objc_class:(NSArray *)args +{ + RETURN_VALUE (NSClassFromString ([args objectAtIndex:0])); +} + ++(NSArray *) ns_log:(NSArray *)args +{ + NSString *description = [[args objectAtIndex:0] descriptionForLisp]; + NSLog (@"%@", description); + RETURN_VALUE ([args objectAtIndex:0]); +} @end |