diff options
author | ee7 <45465154+ee7@users.noreply.github.com> | 2020-07-06 14:02:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-06 14:02:03 +0200 |
commit | a754160d654f03584088412f51b153ae6a170adb (patch) | |
tree | f3263ac6c39acdb2ee188b39f167a0457f4607e8 /lib | |
parent | 65af99a203387882d9fba7d94ae0cd46f479dd1f (diff) | |
download | Nim-a754160d654f03584088412f51b153ae6a170adb.tar.gz |
tables.nim: Add named fields in `smallest` and `largest` (#14919)
The `smallest` and `largest` procs for `CountTable` returned a tuple with named fields, but the same procs for `CountTableRef` returned an anonymous tuple. This commit makes those `CountTableRef` procs more consistent, and adds a test. Fixes: #14918
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/collections/tables.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index 2ea58ce1f..a969a4c5d 100644 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -2670,14 +2670,14 @@ proc inc*[A](t: CountTableRef[A], key: A, val = 1) = doAssert a == newCountTable("aaabbbbbbbbbbb") t[].inc(key, val) -proc smallest*[A](t: CountTableRef[A]): (A, int) = +proc smallest*[A](t: CountTableRef[A]): tuple[key: A, val: int] = ## Returns the ``(key, value)`` pair with the smallest ``val``. Efficiency: O(n) ## ## See also: ## * `largest proc<#largest,CountTableRef[A]>`_ t[].smallest -proc largest*[A](t: CountTableRef[A]): (A, int) = +proc largest*[A](t: CountTableRef[A]): tuple[key: A, val: int] = ## Returns the ``(key, value)`` pair with the largest ``val``. Efficiency: O(n) ## ## See also: |