RedBlackTree enum

Enumerates all entries in key ascending order using an input function with the possibility to interrupt.

Arguments

tree
is the RedBlackTree to enumerate.
body
is the callable to be called for each entry. It has the following stack notation:

( { key value } -- condition )

Each tree entry will be provided as input

{ key value }
structure to the callable. When the output
condition
is FALSE, enumeration interrupts.

Return values

None

Complexity

O(size)

Example

"sl/redBlackTree" useFile a: RedBlackTree; 0 "ZERO" a.insert 34 "element" a.insert -34 "element" a.insert 35 "element" a.insert 32 { a:0; b:1; } a.insert a [print LF print TRUE] enum
Output:
{ key: -34; value: "element"; } { key: 0; value: "ZERO"; } { key: 32; value: { a: 0; b: 1; }; } { key: 34; value: "element"; } { key: 35; value: "element"; }