diff options
Diffstat (limited to 'man')
| -rw-r--r-- | man/man3/tomo-Byte.get_bit.3 | 44 | ||||
| -rw-r--r-- | man/man3/tomo-Int.get_bit.3 | 44 | ||||
| -rw-r--r-- | man/man3/tomo-Path.has_extension.3 | 41 | ||||
| -rw-r--r-- | man/man3/tomo-Table.with_fallback.3 | 40 | ||||
| -rw-r--r-- | man/man3/tomo-Table.xor.3 | 35 |
5 files changed, 204 insertions, 0 deletions
diff --git a/man/man3/tomo-Byte.get_bit.3 b/man/man3/tomo-Byte.get_bit.3 new file mode 100644 index 00000000..85d6c2ae --- /dev/null +++ b/man/man3/tomo-Byte.get_bit.3 @@ -0,0 +1,44 @@ +'\" t +.\" Copyright (c) 2025 Bruce Hill +.\" All rights reserved. +.\" +.TH Byte.get_bit 3 2025-06-26 "Tomo man-pages" +.SH NAME +Byte.get_bit \- check whether a bit is set +.SH LIBRARY +Tomo Standard Library +.SH SYNOPSIS +.nf +.BI Byte.get_bit\ :\ func(i:\ Byte,\ bit_index:\ Int\ ->\ Bool) +.fi +.SH DESCRIPTION +In the binary representation of a byte, check whether a given bit index is set to 1 or not. + + +.SH ARGUMENTS + +.TS +allbox; +lb lb lbx lb +l l l l. +Name Type Description Default +i Byte The byte whose bits are being inspected. - +bit_index Int The index of the bit to check (1-indexed, range 1-8). - +.TE +.SH RETURN +Whether or not the given bit index is set to 1 in the byte. + +.SH NOTES +The bit index must be between 1-8 or a runtime error will be produced. + +.SH EXAMPLES +.EX +>> Byte(6).get_bit(1) += no +>> Byte(6).get_bit(2) += yes +>> Byte(6).get_bit(3) += yes +>> Byte(6).get_bit(4) += no +.EE diff --git a/man/man3/tomo-Int.get_bit.3 b/man/man3/tomo-Int.get_bit.3 new file mode 100644 index 00000000..e0b98909 --- /dev/null +++ b/man/man3/tomo-Int.get_bit.3 @@ -0,0 +1,44 @@ +'\" t +.\" Copyright (c) 2025 Bruce Hill +.\" All rights reserved. +.\" +.TH Int.get_bit 3 2025-06-25 "Tomo man-pages" +.SH NAME +Int.get_bit \- check whether a bit is set +.SH LIBRARY +Tomo Standard Library +.SH SYNOPSIS +.nf +.BI Int.get_bit\ :\ func(i:\ Int,\ bit_index:\ Int\ ->\ Bool) +.fi +.SH DESCRIPTION +In the binary representation of an integer, check whether a given bit index is set to 1 or not. + + +.SH ARGUMENTS + +.TS +allbox; +lb lb lbx lb +l l l l. +Name Type Description Default +i Int The integer whose bits are being inspected. - +bit_index Int The index of the bit to check (1-indexed). - +.TE +.SH RETURN +Whether or not the given bit index is set to 1 in the binary representation of the integer. + +.SH NOTES +For fixed-size integers, the bit index must be between 1 and the number of bits in that integer (i.e. 1-64 for `Int64`). For `Int`, the bit index must be between 1 and `Int64.max`. Values outside this range will produce a runtime error. + +.SH EXAMPLES +.EX +>> (6).get_bit(1) += no +>> (6).get_bit(2) += yes +>> (6).get_bit(3) += yes +>> (6).get_bit(4) += no +.EE diff --git a/man/man3/tomo-Path.has_extension.3 b/man/man3/tomo-Path.has_extension.3 new file mode 100644 index 00000000..4556c819 --- /dev/null +++ b/man/man3/tomo-Path.has_extension.3 @@ -0,0 +1,41 @@ +'\" t +.\" Copyright (c) 2025 Bruce Hill +.\" All rights reserved. +.\" +.TH Path.has_extension 3 2025-06-24 "Tomo man-pages" +.SH NAME +Path.has_extension \- check if a path has a given extension +.SH LIBRARY +Tomo Standard Library +.SH SYNOPSIS +.nf +.BI Path.has_extension\ :\ func(path:\ Path,\ extension:\ Text\ ->\ Bool) +.fi +.SH DESCRIPTION +Return whether or not a path has a given file extension. + + +.SH ARGUMENTS + +.TS +allbox; +lb lb lbx lb +l l l l. +Name Type Description Default +path Path A path. - +extension Text A file extension (leading `.` is optional). If empty, the check will test if the file does not have any file extension. - +.TE +.SH RETURN +Whether or not the path has the given extension. + +.SH EXAMPLES +.EX +>> (/foo.txt).has_extension("txt") += yes +>> (/foo.txt).has_extension(".txt") += yes +>> (/foo.tar.gz).has_extension("gz") += yes +>> (/foo.tar.gz).has_extension("zip") += no +.EE diff --git a/man/man3/tomo-Table.with_fallback.3 b/man/man3/tomo-Table.with_fallback.3 new file mode 100644 index 00000000..89c78fe1 --- /dev/null +++ b/man/man3/tomo-Table.with_fallback.3 @@ -0,0 +1,40 @@ +'\" t +.\" Copyright (c) 2025 Bruce Hill +.\" All rights reserved. +.\" +.TH Table.with_fallback 3 2025-06-24 "Tomo man-pages" +.SH NAME +Table.with_fallback \- return a table with a new fallback +.SH LIBRARY +Tomo Standard Library +.SH SYNOPSIS +.nf +.BI Table.with_fallback\ :\ func(t:\ {K=V},\ fallback:\ {K=V}?\ ->\ {K=V}) +.fi +.SH DESCRIPTION +Return a copy of a table with a different fallback table. + + +.SH ARGUMENTS + +.TS +allbox; +lb lb lbx lb +l l l l. +Name Type Description Default +t {K=V} The table whose fallback will be replaced. - +fallback {K=V}? The new fallback table value. - +.TE +.SH RETURN +The original table with a different fallback. + +.SH EXAMPLES +.EX +t := {"A"=1; fallback={"B"=2}} +t2 = t.with_fallback({"B"=3"}) +>> t2["B"] += 3? +t3 = t.with_fallback(none) +>> t2["B"] += none +.EE diff --git a/man/man3/tomo-Table.xor.3 b/man/man3/tomo-Table.xor.3 new file mode 100644 index 00000000..8d3cb8f2 --- /dev/null +++ b/man/man3/tomo-Table.xor.3 @@ -0,0 +1,35 @@ +'\" t +.\" Copyright (c) 2025 Bruce Hill +.\" All rights reserved. +.\" +.TH Table.xor 3 2025-06-24 "Tomo man-pages" +.SH NAME +Table.xor \- symmetric difference +.SH LIBRARY +Tomo Standard Library +.SH SYNOPSIS +.nf +.BI Table.xor\ :\ func(a:\ |T|,\ b:\ |T|\ ->\ |T|) +.fi +.SH DESCRIPTION +Return set with the elements in one, but not both of the arguments. This is also known as the symmetric difference or disjunctive union. + + +.SH ARGUMENTS + +.TS +allbox; +lb lb lbx lb +l l l l. +Name Type Description Default +a |T| The first set. - +b |T| The second set. - +.TE +.SH RETURN +A set with the symmetric difference of the arguments. + +.SH EXAMPLES +.EX +>> |1, 2, 3|.xor(|2, 3, 4|) += |1, 4| +.EE |
