added map to sets
This commit is contained in:
parent
5d93957048
commit
0b5c14962e
2 changed files with 17 additions and 0 deletions
|
|
@ -241,3 +241,7 @@ proc `<=`*[A](s, t: TSet[A]): bool =
|
|||
|
||||
proc `==`*[A](s, t: TSet[A]): bool =
|
||||
s.counter == t.counter and s <= t
|
||||
|
||||
proc map*[A, B](data: TSet[A], op: proc (x: A): B {.closure.}): TSet[A] =
|
||||
result = initSet[B]()
|
||||
for i in data: result.incl(op(i))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue