summaryrefslogtreecommitdiff
path: root/doc
diff options
authorBurdette Lamar <[email protected]>2025-02-10 13:32:25 -0600
committerGitHub <[email protected]>2025-02-10 14:32:25 -0500
commitb4bf3ed13036a01c2082bd279e6faecd5d51a740 (patch)
treee45a67ae441d67c66ce4cd364ba7fb4c0acaa950 /doc
parent7fd589c7fc26b0494990134d6bef699c92a9336c (diff)
[DOC] Adds section "Hash Inclusion" (#12634)
Notes
Notes: Merged-By: peterzhu2118 <[email protected]>
Diffstat (limited to 'doc')
-rw-r--r--doc/hash_inclusion.rdoc31
1 files changed, 31 insertions, 0 deletions
diff --git a/doc/hash_inclusion.rdoc b/doc/hash_inclusion.rdoc
new file mode 100644
index 0000000000..05c2b0932a
--- /dev/null
+++ b/doc/hash_inclusion.rdoc
@@ -0,0 +1,31 @@
+== \Hash Inclusion
+
+A hash is set-like in that it cannot have duplicate entries
+(or even duplicate keys).
+\Hash inclusion can therefore based on the idea of
+{subset and superset}[https://en.wikipedia.org/wiki/Subset].
+
+Two hashes may be tested for inclusion,
+based on comparisons of their entries.
+
+An entry <tt>h0[k0]</tt> in one hash
+is equal to an entry <tt>h1[k1]</tt> in another hash
+if and only if the two keys are equal (<tt>k0 == k1</tt>)
+and their two values are equal (<tt>h0[k0] == h1[h1]</tt>).
+
+A hash may be a subset or a superset of another hash:
+
+- Subset (included in or equal to another):
+
+ - \Hash +h0+ is a _subset_ of hash +h1+ (see Hash#<=)
+ if each entry in +h0+ is equal to an entry in +h1+.
+ - Further, +h0+ is a <i>proper subset</i> of +h1+ (see Hash#<)
+ if +h1+ is larger than +h0+.
+
+- Superset (including or equal to another):
+
+ - \Hash +h0+ is a _superset_ of hash +h1+ (see Hash#>=)
+ if each entry in +h1+ is equal to an entry in +h0+.
+ - Further, +h0+ is a <i>proper superset</i> of +h1+ (see Hash#>)
+ if +h0+ is larger than +h1+.
+