(node>subalist) ( from-key to-key node start-comparator: ( key1 key2 -- ? ) end-comparator: ( key1 key2 -- ? ) -- )


Vocabulary
trees.private

Inputs
from-keyan object
to-keyan object
nodean object
start-comparatora quotation with stack effect ( key1 key2 -- ? )
end-comparatora quotation with stack effect ( key1 key2 -- ? )


Outputs
None

Definition


:: (node>subalist)
( from-key to-key node start-comparator: ( key1 key2 -- ? ) end-comparator: ( key1 key2 -- ? ) -- )
node [
node key>> from-key start-comparator call
:> node-right? node key>> to-key end-comparator call
:> node-left? node-right? [
from-key node left>> node-left?
[ start-comparator (node>subalist-left) ] [
[ to-key ] dip
start-comparator end-comparator (node>subalist)
] if
] when node-right? node-left? and [ node entry, ] when
node-left? [
to-key node right>> node-right?
[ end-comparator (node>subalist-right) ] [
[ from-key ] 2dip
start-comparator end-comparator (node>subalist)
] if
] when
] when ; inline recursive