nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3549f7c
)
counter: fix add all behavior
author
Alexandre Terrasa
<alexandre@moz-code.org>
Mon, 27 Feb 2017 19:37:38 +0000
(14:37 -0500)
committer
Alexandre Terrasa
<alexandre@moz-code.org>
Mon, 27 Feb 2017 19:37:38 +0000
(14:37 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
lib/counter.nit
patch
|
blob
|
history
diff --git
a/lib/counter.nit
b/lib/counter.nit
index
ceb9896
..
e539bc5
100644
(file)
--- a/
lib/counter.nit
+++ b/
lib/counter.nit
@@
-80,6
+80,12
@@
class Counter[E]
map.clear
end
+ redef fun add_all(other) do
+ for k, v in other do
+ self[k] += v
+ end
+ end
+
# Count one more occurrence of `e`
fun inc(e: E)
do