code / tomo

Lines41.3K C23.7K Markdown9.7K YAML5.0K Tomo2.3K
7 others 763
Python231 Shell230 make212 INI47 Text21 SVG16 Lua6
(123 lines)
1 '\" t
2 .\" Copyright (c) 2026 Bruce Hill
3 .\" All rights reserved.
4 .\"
5 .TH Int 3 2026-03-08 "Tomo man-pages"
6 .SH NAME
7 Int \- a Tomo type
8 .SH LIBRARY
9 Tomo Standard Library
10 .fi
11 .SH METHODS
13 .TP
14 .BI Int.abs\ :\ func(x:\ Int\ ->\ Int)
15 Calculates the absolute value of an integer.
17 For more, see:
18 .BR Tomo-Int.abs (3)
21 .TP
22 .BI Int.choose\ :\ func(n:\ Int,\ k:\ Int\ ->\ Int)
23 Computes the binomial coefficient of the given numbers (the equivalent of \fBn\fR choose \fBk\fR in combinatorics). This is equal to \fBn.factorial()/(k.factorial() * (n-k).factorial())\fR.
25 For more, see:
26 .BR Tomo-Int.choose (3)
29 .TP
30 .BI Int.clamped\ :\ func(x:\ Int,\ low:\ Int,\ high:\ Int\ ->\ Int)
31 Returns the given number clamped between two values so that it is within that range.
33 For more, see:
34 .BR Tomo-Int.clamped (3)
37 .TP
38 .BI Int.factorial\ :\ func(n:\ Int\ ->\ Text)
39 Computes the factorial of an integer.
41 For more, see:
42 .BR Tomo-Int.factorial (3)
45 .TP
46 .BI Int.get_bit\ :\ func(i:\ Int,\ bit_index:\ Int\ ->\ Bool)
47 In the binary representation of an integer, check whether a given bit index is set to 1 or not.
49 For more, see:
50 .BR Tomo-Int.get_bit (3)
53 .TP
54 .BI Int.hex\ :\ func(i:\ Int,\ digits:\ Int\ =\ 0,\ uppercase:\ Bool\ =\ yes,\ prefix:\ Bool\ =\ yes\ ->\ Text)
55 Converts an integer to its hexadecimal representation.
57 For more, see:
58 .BR Tomo-Int.hex (3)
61 .TP
62 .BI Int.is_between\ :\ func(x:\ Int,\ a:\ Int,\ b:\ Int\ ->\ Bool)
63 Determines if an integer is between two numbers (inclusive).
65 For more, see:
66 .BR Tomo-Int.is_between (3)
69 .TP
70 .BI Int.is_prime\ :\ func(x:\ Int,\ reps:\ Int\ =\ 50\ ->\ Bool)
71 Determines if an integer is a prime number.
73 For more, see:
74 .BR Tomo-Int.is_prime (3)
77 .TP
78 .BI Int.next_prime\ :\ func(x:\ Int\ ->\ Int)
79 Finds the next prime number greater than the given integer.
81 For more, see:
82 .BR Tomo-Int.next_prime (3)
85 .TP
86 .BI Int.octal\ :\ func(i:\ Int,\ digits:\ Int\ =\ 0,\ prefix:\ Bool\ =\ yes\ ->\ Text)
87 Converts an integer to its octal representation.
89 For more, see:
90 .BR Tomo-Int.octal (3)
93 .TP
94 .BI Int.onward\ :\ func(first:\ Int,\ step:\ Int\ =\ 1\ ->\ Text)
95 Return an iterator that counts infinitely from the starting integer (with an optional step size).
97 For more, see:
98 .BR Tomo-Int.onward (3)
101 .TP
102 .BI Int.parse\ :\ func(text:\ Text,\ base:\ Int?\ =\ none,\ remainder:\ &Text?\ =\ none\ ->\ Int?)
103 Converts a text representation of an integer into an integer.
105 For more, see:
106 .BR Tomo-Int.parse (3)
109 .TP
110 .BI Int.sqrt\ :\ func(x:\ Int\ ->\ Int)
111 Calculates the nearest square root of an integer.
113 For more, see:
114 .BR Tomo-Int.sqrt (3)
117 .TP
118 .BI Int.to\ :\ func(first:\ Int,\ last:\ Int,\ step:\ Int?\ =\ none\ ->\ func(->Int?))
119 Returns an iterator function that iterates over the range of numbers specified.
121 For more, see:
122 .BR Tomo-Int.to (3)