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.101 x86.64 (2284, heads/master-29a92525f9, Nov 9 2024 06:55:18)