#import <cons.h>
Inheritance diagram for Cons:
Public Member Functions | |
(void) | - append: |
Appends o to end of list. | |
(void) | - appendList: |
Appends argument list to end of self. | |
(id) | - first |
Returns the first/car pointer. | |
(id) | - rest |
Returns the rest/cdr pointer. | |
(void) | - setFirst: |
Sets the first/car pointer. | |
(void) | - setRest: |
Sets the rest/cdr pointer. | |
(id) | - car |
Returns the first/car pointer. | |
(id) | - cdr |
Returns the rest/cdr pointer. | |
(id *) | - pcar |
Returns pointer to the first/car pointer. | |
(id *) | - pcdr |
Returns pointer to the rest/cdr pointer. | |
(id *) | - pfirst |
Returns pointer to the first/car pointer. | |
(id *) | - prest |
Returns pointer to the rest/cdr pointer. | |
(void) | - nilCars |
Sets all cars in list to nil. | |
(void) | - setCar: |
Sets the first/car pointer. | |
(void) | - setCdr: |
Sets the rest/cdr pointer. | |
(BOOL) | - areMembersOf: |
Returns true if each car is of class c. | |
(BOOL) | - areKindsOf: |
Returns true if each car is of class c or descendent of c. | |
(id) | - stealCar |
Returns CAR then nils it in cell. | |
(id) | - stealCdr |
Returns CDR then nils it in cell. | |
(int) | - size |
Length of the list. | |
Static Public Member Functions | |
(void) | + appendTo:item: |
Appends item:o to *pcons or creates new cell if *pcons is null. | |
Protected Attributes | |
id | first |
aka car | |
id | rest |
aka cdr |
+ (void) appendTo: | (Cons **) | pcons | ||
item: | (id) | o | ||
Appends item:o to *pcons or creates new cell if *pcons is null.
pcons | pointer to the list | |
o | object to append |
- (void) append: | (id) | o |
Appends o to end of list.
- (void) appendList: | (Cons *) | o |
Appends argument list to end of self.
Self now owns all of the argument list.
- (void) nilCars |
Sets all cars in list to nil.
Does not free cars.
- (id) stealCar |
Returns CAR then nils it in cell.
We must assume ownership of return value, since the cell was the previous owner due to the fact that cells free all CAR's when they are free'd.
- (id) stealCdr |
Returns CDR then nils it in cell.
We must assume ownership of return value, since the cell was the previous owner due to the fact that cells free all CAR's when they are free'd.