Double-linked lists - Factor Documentation (original) (raw)

A double-linked list is the canonical implementation of a deque.

Double-linked lists form a class:

dlist

dlist? ( object -- ? )

Constructing a double-linked list:

( -- list )

Double-linked lists support all the operations of the deque protocol (Deques) as well as the following.

Iterating over elements:

dlist-each ( ... dlist quot: ( ... value -- ... ) -- ... )

dlist-find ( ... dlist quot: ( ... value -- ... ? ) -- ... obj/f ? )
dlist-filter ( ... dlist quot: ( ... value -- ... ? ) -- ... dlist' )
dlist-any? ( ... dlist quot: ( ... value -- ... ? ) -- ... ? )

Deleting a node matching a predicate:

delete-node-if* ( ... dlist quot: ( ... value -- ... ? ) -- ... obj/f ? )

delete-node-if ( ... dlist quot: ( ... value -- ... ? ) -- ... obj/f )

Search deque implementation:

( -- search-deque )