aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Int.choose.3
blob: 1e5c705bbeba354b941d84640577dbdc1a43f7da (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
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Int.choose 3 2025-11-29 "Tomo man-pages"
.SH NAME
Int.choose \- binomial coefficient
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Int.choose\ :\ func(n:\ Int,\ k:\ Int\ ->\ Int)
.fi
.SH DESCRIPTION
Computes the binomial coefficient of the given numbers (the equivalent of `n` choose `k` in combinatorics). This is equal to `n.factorial()/(k.factorial() * (n-k).factorial())`.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx
l l l.
Name	Type	Description
n	Int	The number of things to choose from. 
k	Int	The number of things to be chosen. 
.TE
.SH RETURN
The binomial coefficient, equivalent to the number of ways to uniquely choose `k` objects from among `n` objects, ignoring order.

.SH EXAMPLES
.EX
assert (4).choose(2) == 6
.EE
.SH SEE ALSO
.BR Tomo-Int (3)