4 ms·
[post] tl;dr A ( linked ) list is a collection of CONS ( Construct ) cells. A CONS cells can extract, via the commands: ‘car’ ( Contents of Address Register
by deepnet 2y ago
[post] tl;dr
A ( linked ) list is a collection of CONS ( Construct ) cells.
A CONS cells can extract, via the commands:
‘car’ ( Contents of Address Register ) - the payload ( data item in list );
‘cdr’ ( Contents of Decrement Register ) - the link ( to the next list item, e.g. CONS cell )
The names are for historical reasons ( using two halves of a single register ) lost in the beards of yore.
The linked list appears simple, this belies the fact of its exquisite perfection and the great thought that went into inventing, perfecting and implementing it.
“[The ‘list’ command]… creates a series of conses and sets the CAR pointers to point to each argument. which you have provided. (LIST (LIST 1 2) (LIST 3 4)) => ((1 2) (3 4))