summaryrefslogtreecommitdiff
path: root/MLKCons.h
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-29 16:35:14 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-29 16:35:14 +0200
commit43921ef49a4c9a4acf2182728c60a52f71dd95ec (patch)
tree1c3e41ad1f10e191746c7f50dbcde1c5e12d0a1e /MLKCons.h
parent63eadba1c4ed6e92aeda0a0691e0ac97ce580a43 (diff)
parentea78de039ba122180ac0fe7ffbdca4073342ad0c (diff)
Merge mulk_benkard@ssh.phx.nearlyfreespeech.net:/home/htdocs/code/mulklisp
Diffstat (limited to 'MLKCons.h')
-rw-r--r--MLKCons.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/MLKCons.h b/MLKCons.h
index 84d3c56..4b46272 100644
--- a/MLKCons.h
+++ b/MLKCons.h
@@ -19,22 +19,78 @@
#import <Foundation/NSArray.h>
+/* Class: MLKCons
+
+ A cons cell.
+
+ A cons cell (or simply: a cons) is an ordered pair whose first
+ element is called the car and whose second element is called the cdr
+ of the cons. Cons cells are mutable by default.
+
+ Note that nil is explicitely allowed as both the car and cdr of a
+ cons cell. In fact, when representing linked lists using cons cells,
+ nil in the cdr of the last cons cell is what conventionally marks the
+ end of a list.
+*/
@interface MLKCons : NSObject <NSCopying>
{
id _car;
id _cdr;
}
+/* Method: +cons:with:
+
+ Cons two objects together.
+
+ Arguments:
+
+ car - The car of the new cons cell.
+ cdr - The cdr of the new cons cell.
+
+ Returns: A newly allocated cons.
+*/
+(MLKCons*) cons:(id)car with:(id)cdr;
+
+
+/* Method: +listWithArray:
+
+ Make a linked list of cons cells out of an array. */
+(MLKCons*) listWithArray:(NSArray *)array;
+/* Method: -initWithCar:cdr:
+
+ Initialise a new cons cell with car and cdr.
+*/
-(MLKCons*) initWithCar:(id)car cdr:(id)cdr;
+/* Method: -car
+
+ The car of the cons cell.
+*/
-(id) car;
+
+/* Method: -cdr
+
+ The cdr of the cons cell.
+*/
-(id) cdr;
+
+/* Method: -setCar:
+
+ Change the car of the cons cell.
+*/
-(void) setCar:(id)value;
+
+/* Method: -setCdr:
+
+ Change the cdr of the cons cell.
+*/
-(void) setCdr:(id)value;
+/* Method: -array
+
+ Return the content of the linked list represented by this cons cell as an array.
+*/
-(NSArray *) array;
-(void) appendObject:(id)object;