diff options
Diffstat (limited to 'man')
| -rw-r--r-- | man/man3/tomo-Table.difference.3 | 36 | ||||
| -rw-r--r-- | man/man3/tomo-Table.intersection.3 | 36 | ||||
| -rw-r--r-- | man/man3/tomo-Table.with.3 | 35 | ||||
| -rw-r--r-- | man/man3/tomo-Table.without.3 | 38 |
4 files changed, 145 insertions, 0 deletions
diff --git a/man/man3/tomo-Table.difference.3 b/man/man3/tomo-Table.difference.3 new file mode 100644 index 00000000..8f123834 --- /dev/null +++ b/man/man3/tomo-Table.difference.3 @@ -0,0 +1,36 @@ +'\" t +.\" Copyright (c) 2025 Bruce Hill +.\" All rights reserved. +.\" +.TH Table.difference 3 2025-09-21 "Tomo man-pages" +.SH NAME +Table.difference \- return a table using keys not present in both tables +.SH LIBRARY +Tomo Standard Library +.SH SYNOPSIS +.nf +.BI Table.difference\ :\ func(t:\ {K:V},\ other:\ {K:V}\ ->\ {K:V}) +.fi +.SH DESCRIPTION +Return a table whose key/value pairs correspond to keys only present in one table, but not the other. + + +.SH ARGUMENTS + +.TS +allbox; +lb lb lbx lb +l l l l. +Name Type Description Default +t {K:V} The base table. - +other {K:V} The other table. - +.TE +.SH RETURN +A table containing the common key/value pairs whose keys only appear in one table. + +.SH EXAMPLES +.EX +t1 := {"A": 1; "B": 2, "C": 3} +t2 := {"B": 2, "C":30, "D": 40} +assert t1.difference(t2) == {"A": 1, "D": 40} +.EE diff --git a/man/man3/tomo-Table.intersection.3 b/man/man3/tomo-Table.intersection.3 new file mode 100644 index 00000000..64a2e32c --- /dev/null +++ b/man/man3/tomo-Table.intersection.3 @@ -0,0 +1,36 @@ +'\" t +.\" Copyright (c) 2025 Bruce Hill +.\" All rights reserved. +.\" +.TH Table.intersection 3 2025-09-21 "Tomo man-pages" +.SH NAME +Table.intersection \- return a table with common key/value pairs from two tables +.SH LIBRARY +Tomo Standard Library +.SH SYNOPSIS +.nf +.BI Table.intersection\ :\ func(t:\ {K:V},\ other:\ {K:V}\ ->\ {K:V}) +.fi +.SH DESCRIPTION +Return a table with only the matching key/value pairs that are common to both tables. + + +.SH ARGUMENTS + +.TS +allbox; +lb lb lbx lb +l l l l. +Name Type Description Default +t {K:V} The base table. - +other {K:V} The other table. - +.TE +.SH RETURN +A table containing the common key/value pairs shared between two tables. + +.SH EXAMPLES +.EX +t1 := {"A": 1; "B": 2, "C": 3} +t2 := {"B": 2, "C":30, "D": 40} +assert t1.intersection(t2) == {"B": 2} +.EE diff --git a/man/man3/tomo-Table.with.3 b/man/man3/tomo-Table.with.3 new file mode 100644 index 00000000..988fb888 --- /dev/null +++ b/man/man3/tomo-Table.with.3 @@ -0,0 +1,35 @@ +'\" t +.\" Copyright (c) 2025 Bruce Hill +.\" All rights reserved. +.\" +.TH Table.with 3 2025-09-21 "Tomo man-pages" +.SH NAME +Table.with \- return a table with values added from another table +.SH LIBRARY +Tomo Standard Library +.SH SYNOPSIS +.nf +.BI Table.with\ :\ func(t:\ {K:V},\ other:\ {K:V}\ ->\ {K:V}) +.fi +.SH DESCRIPTION +Return a copy of a table with values added from another table + + +.SH ARGUMENTS + +.TS +allbox; +lb lb lbx lb +l l l l. +Name Type Description Default +t {K:V} The base table. - +other {K:V} The other table from which new key/value pairs will be added. - +.TE +.SH RETURN +The original table, but with values from the other table added. + +.SH EXAMPLES +.EX +t := {"A": 1; "B": 2} +assert t.with({"B": 20, "C": 30}) == {"A": 1, "B": 20, "C": 30} +.EE diff --git a/man/man3/tomo-Table.without.3 b/man/man3/tomo-Table.without.3 new file mode 100644 index 00000000..7244dac6 --- /dev/null +++ b/man/man3/tomo-Table.without.3 @@ -0,0 +1,38 @@ +'\" t +.\" Copyright (c) 2025 Bruce Hill +.\" All rights reserved. +.\" +.TH Table.without 3 2025-09-21 "Tomo man-pages" +.SH NAME +Table.without \- return a table without key/value pairs in another table +.SH LIBRARY +Tomo Standard Library +.SH SYNOPSIS +.nf +.BI Table.without\ :\ func(t:\ {K:V},\ other:\ {K:V}\ ->\ {K:V}) +.fi +.SH DESCRIPTION +Return a copy of a table, but without any of the exact key/value pairs found in the other table. + + +.SH ARGUMENTS + +.TS +allbox; +lb lb lbx lb +l l l l. +Name Type Description Default +t {K:V} The base table. - +other {K:V} The other table whose key/value pairs will be omitted. - +.TE +.SH RETURN +The original table, but without the key/value pairs from the other table. + +.SH NOTES +Only exact key/value pairs will be discarded. Keys with a non-matching value will be kept. + +.SH EXAMPLES +.EX +t := {"A": 1; "B": 2, "C": 3} +assert t.without({"B": 2, "C": 30, "D": 40}) == {"A": 1, "C": 3} +.EE |
