1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
source: src/internal/vm/tests.rs
expression: snapshot
---
# Source:
class Counter:
n = 0
max = 0
init(self, max):
self.max = max
fn iter(self):
return self
fn next(self):
if self.n < self.max:
n := self.n
self.n += 1
return n
fn done(self):
return self.n >= self.max
collect(Counter(10))
# Result:
Object(
[
Int(
0,
),
Int(
1,
),
Int(
2,
),
Int(
3,
),
Int(
4,
),
Int(
5,
),
Int(
6,
),
Int(
7,
),
Int(
8,
),
Int(
9,
),
],
)