blob: 02631ba6b1c43773205c0b62996bd51a89a7ee86 (
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
39
40
41
42
43
|
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH List.remove_item 3 2025-09-21 "Tomo man-pages"
.SH NAME
List.remove_item \- remove an item by value
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI List.remove_item\ :\ func(list:\ @[T],\ item:\ T,\ max_count:\ Int\ =\ -1\ ->\ Void)
.fi
.SH DESCRIPTION
Removes all occurrences of a specified item from the list.
.SH ARGUMENTS
.TS
allbox;
lb lb lbx lb
l l l l.
Name Type Description Default
list @[T] The mutable reference to the list. -
item T The item to be removed. -
max_count Int The maximum number of occurrences to remove. -1
.TE
.SH RETURN
Nothing.
.SH NOTES
A negative `max_count` means "remove all occurrences".
.SH EXAMPLES
.EX
list := [10, 20, 10, 20, 30]
list.remove_item(10)
assert list == [20, 20, 30]
list.remove_item(20, max_count=1)
assert list == [20, 30]
.EE
|