From 14fc7437c330f36d19bc4ee707c8102f6f6bb190 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Wed, 17 Apr 2019 04:57:32 -0500 Subject: [PATCH] Improve tables docs for del/take (#11030) * Continuation of b40a637f * https://forum.nim-lang.org/t/4789 --- lib/pure/collections/tables.nim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index 50c727be1b..c6d5cc9e28 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