aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-List.counts.3
blob: c4e2230334e9bae89bc788fe82fcbce24acbde21 (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
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH List.counts 3 2025-11-29 "Tomo man-pages"
.SH NAME
List.counts \- count occurrences
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI List.counts\ :\ func(list:\ [T]\ ->\ {T=Int})
.fi
.SH DESCRIPTION
Counts the occurrences of each element in the list.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
list	[T]	The list to count elements in. 	-
.TE
.SH RETURN
A table mapping each element to its count.

.SH EXAMPLES
.EX
assert [10, 20, 30, 30, 30].counts() == {10=1, 20=1, 30=3}
.EE
.SH SEE ALSO
.BR Tomo-List (3)