Linked lists and higher-order functions in Javascript.