Skip to content

Commit 7c5f131

Browse files
committed
added SliceIterator
1 parent e6ab72a commit 7c5f131

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ v.display()
5858

5959
### Bugs
6060

61+
- creating 2 long lists causes the first list to be an element of the second
62+
list?
6163
- fix tuple parsing...
6264
- methods with self and an arg don't work due to calling convention
6365
- i suspect its because were not allocating space for the extra self at

example/test.gila

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@
33

44

55

6+
l1 = [3,4,2,1,3,3]
67

8+
l2 = [4,3,5,3,9,3]
79

810

9-
for _ in 0..1_000
10-
print("hi")
11+
12+
13+
s = SliceIterator(counter=0,s=l1)
14+
15+
print(s)
16+
17+
18+
for _ in s
19+
print("foo")

prelude/prelude.gila

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,15 @@ end
2020
__iter fn(self: RangeIterator) -> bool do
2121
self.counter = self.counter + 1
2222
return self.counter==self.limit+1
23+
end
24+
25+
26+
SliceIterator type
27+
counter: u32
28+
s: any[]
29+
end
30+
31+
__iter fn(self: SliceIterator) -> bool do
32+
self.counter = self.counter + 1
33+
return self.counter == len(self.s)
2334
end

0 commit comments

Comments
 (0)