(123 lines)
1 '\" t2 .\" Copyright (c) 2026 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Int 3 2026-03-08 "Tomo man-pages"6 .SH NAME7 Int \- a Tomo type8 .SH LIBRARY9 Tomo Standard Library10 .fi11 .SH METHODS13 .TP14 .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 .TP22 .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 .TP30 .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 .TP38 .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 .TP46 .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 .TP54 .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 .TP62 .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 .TP70 .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 .TP78 .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 .TP86 .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 .TP94 .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 .TP102 .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 .TP110 .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 .TP118 .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)