summaryrefslogtreecommitdiff
path: root/MLKCons.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-06-17 16:11:43 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-06-17 16:11:43 +0200
commitd6d73cfbcfd4eae88e53c4c30e221a66daade5e1 (patch)
tree844f1974e5d2fe9e5859ea6e7ddf6e506fc64e54 /MLKCons.m
parent1cf2f94d79396d81bdc798768687c1bef86a9102 (diff)
MLKCons, MLKSymbol: Override -descriptionForLisp.
Diffstat (limited to 'MLKCons.m')
-rw-r--r--MLKCons.m21
1 files changed, 21 insertions, 0 deletions
diff --git a/MLKCons.m b/MLKCons.m
index fbfecb7..aee322a 100644
--- a/MLKCons.m
+++ b/MLKCons.m
@@ -18,6 +18,8 @@
#import "MLKCons.h"
+#import <Foundation/NSString.h>
+
@implementation MLKCons
+(MLKCons*) cons:(id)car with:(id)cdr
@@ -54,6 +56,25 @@
ASSIGN (_cdr, value);
}
+-(NSString *)bareDescriptionForLisp
+{
+ if (!_cdr)
+ return [NSString stringWithFormat:@"%@", [_car descriptionForLisp]];
+ else if (![_cdr isKindOfClass:[MLKCons class]])
+ return [NSString stringWithFormat:@"%@ %@",
+ [_car descriptionForLisp],
+ [_cdr bareDescriptionForLisp]];
+ else
+ return [NSString stringWithFormat:@"%@ . %@",
+ [_car descriptionForLisp],
+ [_cdr descriptionForLisp]];
+}
+
+-(NSString *)descriptionForLisp
+{
+ return [NSString stringWithFormat:@"(%@)", [self bareDescriptionForLisp]];
+}
+
-(void) dealloc
{
RELEASE (_car);