diff options
author | Christopher Dunn <cdunn2001@gmail.com> | 2019-04-17 04:57:32 -0500 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-04-17 11:57:32 +0200 |
commit | 14fc7437c330f36d19bc4ee707c8102f6f6bb190 (patch) | |
tree | 9c9f9551a763b6924044562d00f4b21f110b5862 /lib | |
parent | 7d8af25d5828e67f10c0f5a75abf9ee8fc02a9bb (diff) | |
download | Nim-14fc7437c330f36d19bc4ee707c8102f6f6bb190.tar.gz |
Improve tables docs for del/take (#11030)
* Continuation of b40a637f * https://forum.nim-lang.org/t/4789
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/collections/tables.nim | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index 50c727be1..c6d5cc9e2 100644 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -87,7 +87,7 @@ ## for pairs in zip(years, names): ## let (birthYear, name) = pairs ## if not beatlesByYear.hasKey(birthYear): -## # if a key doesn't exists, we create one with an empty sequence +## # if a key doesn't exist, we create one with an empty sequence ## # before we can add elements to it ## beatlesByYear[birthYear] = @[] ## beatlesByYear[birthYear].add(name) @@ -977,6 +977,8 @@ proc add*[A, B](t: TableRef[A, B], key: A, val: B) = proc del*[A, B](t: TableRef[A, B], key: A) = ## Deletes ``key`` from hash table ``t``. Does nothing if the key does not exist. ## + ## **If duplicate keys were added, this may need to be called multiple times.** + ## ## See also: ## * `take proc<#take,TableRef[A,B],A,B>`_ ## * `clear proc<#clear,TableRef[A,B]>`_ to empty the whole table @@ -994,6 +996,8 @@ proc take*[A, B](t: TableRef[A, B], key: A, val: var B): bool = ## mapping of the key. Otherwise, returns ``false``, and the ``val`` is ## unchanged. ## + ## **If duplicate keys were added, this may need to be called multiple times.** + ## ## See also: ## * `del proc<#del,TableRef[A,B],A>`_ ## * `clear proc<#clear,TableRef[A,B]>`_ to empty the whole table |