Adds definition of card term to sets module.
This commit is contained in:
parent
b87ec14579
commit
e9417b55cf
1 changed files with 6 additions and 0 deletions
|
|
@ -65,6 +65,9 @@ proc len*[A](s: TSet[A]): int =
|
|||
|
||||
proc card*[A](s: TSet[A]): int =
|
||||
## Alias for `len() <#len,TSet[A]>`_.
|
||||
##
|
||||
## Card stands for the `cardinality
|
||||
## <http://en.wikipedia.org/wiki/Cardinality>`_ of a set.
|
||||
result = s.counter
|
||||
|
||||
iterator items*[A](s: TSet[A]): A =
|
||||
|
|
@ -530,6 +533,9 @@ proc len*[A](s: TOrderedSet[A]): int {.inline.} =
|
|||
|
||||
proc card*[A](s: TOrderedSet[A]): int {.inline.} =
|
||||
## Alias for `len() <#len,TOrderedSet[A]>`_.
|
||||
##
|
||||
## Card stands for the `cardinality
|
||||
## <http://en.wikipedia.org/wiki/Cardinality>`_ of a set.
|
||||
result = s.counter
|
||||
|
||||
template forAllOrderedPairs(yieldStmt: stmt) {.dirty, immediate.} =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue