iterate-heap-while ( heap quot1: ( value key -- slurp? ) quot2: ( value key -- obj/f ) -- obj/f loop? )


Vocabulary
sequences.extras

Inputs
heapan object
quot1a quotation
quot2a quotation


Outputs
obj/fan object or f
loop?an object


Definition


: iterate-heap-while
( heap quot1: ( value key -- slurp? ) quot2: ( value key -- obj/f ) -- obj/f loop? )
pick heap-empty?
[ 3drop f f ] [
[ [ heap-peek ] 2dip drop 2keep ] [
nip 5roll [
swap heap-pop*
( value key -- obj/f ) call-effect t
] [ 4drop f f ] if
] 3bi
] if ; inline