ruby-like doubly linked list implementation