Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Ringo.DllSourceDll is a potentially useful module that is used internally to manage bounded, LRU collections of items. The documentation is available in UNBOXED_COLLECTION.
It is implemented as an abstraction over a doubly-linked list.
The implementations of Ring and Dll are functionally indistinguishable. However, their memory consumption differs. On the one hand, with a Ring, the whole structure is allocated in its entirety as soon as a single element is added. Afterwards, there are no more allocations.
On the other hand, with a Dll, cells holding the added values are allocated on a by-need basis. Inserting a supernumerary element renders one single cell garbage-collectible.
In other words, Ring allocates a bigger chunk of data in one go but is stable afterwards, whereas Dll allocates small chunks of data one-by-one.
A mutable structure that holds at most a fixed number of values of a same type. Values are not removed by hand, instead, once the limit is reached, adding a value replaces the oldest one in the buffer.
The type of bounded-size buffers.
add b v adds the value v to the buffer b. If the buffer b already has capacity b values, the oldest of its values is dropped.
add_and_return_erased b v has the same effect as add b v but it returns the dropped value when applicable.
add_list b vs adds each element of the list vs in the order they appear in the list. Note that if List.length vs > capacity b, then only the last capacity b elements of the list remain in b at the end.
fold b ~init ~f folds over the value of the buffer b, newest to oldest.
fold_oldest_first b ~init ~f folds over the value of the buffer b, oldest to newest.