Vocabulary

heaps.private

Definition

Methods

heaps.private

Definition

Methods

M:: heap heap-delete ( entry heap -- )

entry heap entry>index

:> n heap data>> :> data data pop :> nth-entry f entry

index<< n data length = [

nth-entry n data data-set-nth n 0 =

[ t ] [ nth-entry n up data data-nth heap heap-compare ]

if [ heap n sift-up ] [ heap 0 n sift-down ] if

] unless ;

entry heap entry>index

:> n heap data>> :> data data pop :> nth-entry f entry

index<< n data length = [

nth-entry n data data-set-nth n 0 =

[ t ] [ nth-entry n up data data-nth heap heap-compare ]

if [ heap n sift-up ] [ heap 0 n sift-down ] if

] unless ;

M: heap heap-pop*

dup data>> f over first index<< [ pop ] keep

[ 2drop ] [ set-first 0 sift-up ] if-empty ;

dup data>> f over first index<< [ pop ] keep

[ 2drop ] [ set-first 0 sift-up ] if-empty ;

This documentation was generated offline from a
`load-all`

image. If you want, you can also
browse the documentation from within the UI developer tools. See
the Factor website
for more information.

Factor 0.100 x86.64 (2250, heads/master-3623a4e0d7, Nov 15 2023 18:16:06)