class Range {
start: Int;
current: Int;
end: Int;
}
fn iterator(it: Range) -> Range {
return *it;
}
fn next(it: @Range) -> Int {
let curr: @Int = it.current;
curr.inc();
return *curr - 1;
}
fn is_consumed(it: @Range) -> Bool {
return it.current >= it.end;
}
implement Iterable<Range, Int> for Range;
fn range(from: Int, to: Int) -> Range {
return Range(*from, *from, *to);
}
fn irange(from: Int, to: Int) -> Range {
return Range(*from, *from, *to + 1);
}
binary op "=>" (10000);
op (from: Int) => (to: Int) -> Range {
return range(*from, *to);
}