blob: 2d6621eead13d7688a137a4f05237662731d684a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH List.heap_pop 3 2025-11-29 "Tomo man-pages"
.SH NAME
List.heap_pop \- heap pop
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI List.heap_pop\ :\ func(list:\ @[T],\ by:\ func(x,y:&T->Int32)\ =\ T.compare\ ->\ T?)
.fi
.SH DESCRIPTION
Removes and returns the top element of a heap or `none` if the list is empty. By default, this is the *minimum* value in the heap.
.SH ARGUMENTS
.TS
allbox;
lb lb lbx lb
l l l l.
Name Type Description Default
list @[T] The mutable reference to the heap. -
by func(x,y:&T->Int32) The comparison function used to determine order. If not specified, the default comparison function for the item type will be used. T.compare
.TE
.SH RETURN
The removed top element of the heap or `none` if the list is empty.
.SH EXAMPLES
.EX
my_heap := [30, 10, 20]
my_heap.heapify()
assert my_heap.heap_pop() == 10
.EE
.SH SEE ALSO
.BR Tomo-List (3)
|