Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Anybody interested in efficient list (and other data structures, but mostly lists) implementation will probably find the VList approach interesting (relevant paper archived at https://trout.me.uk/lisp/vlist.pdf)


[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))




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: