Handbook
Glossary
iterate-heap-while ( heap quot1: ( value key -- slurp? ) quot2: ( value key -- obj/f ) -- obj/f loop? )
Vocabulary
sequences
.
extras
Inputs
heap
an
object
quot1
a
quotation
quot2
a
quotation
Outputs
obj/f
an
object
or
f
loop?
an
object
Definition
USING:
combinators
heaps
kernel
shuffle
;
IN:
sequences.extras
:
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