nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
lib: add iterate methods on Collection
[nit.git]
/
lib
/
standard
/
collection
/
range.nit
diff --git
a/lib/standard/collection/range.nit
b/lib/standard/collection/range.nit
index
0641c2b
..
aa96cf0
100644
(file)
--- a/
lib/standard/collection/range.nit
+++ b/
lib/standard/collection/range.nit
@@
-42,6
+42,17
@@
special Collection[E]
redef fun iterator do return new IteratorRange[E](self)
+ redef fun iterate
+ !each(e: E)
+ do
+ var c = _first
+ var l = _last
+ while c <= l do
+ each(c)
+ c = c.succ
+ end
+ end
+
redef fun length
do
var nb = _first.distance(_after)