File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ import LIB/default.lsts;
3
+
4
+ let v = mk-vector(type(String), 4);
5
+
6
+ print("part 0 done\n");
7
+
8
+ let ai = 0_u64;
9
+ while ai < 128 {
10
+ v = v.push(to-smart-string(ai));
11
+ ai = ai + 1;
12
+ };
13
+
14
+ print("part 1 done\n");
15
+
16
+ assert(v.length == 128);
17
+ let last-cap = v.capacity;
18
+
19
+ ai = 0_u64;
20
+ for x in v.iter() {
21
+ assert(x == to-smart-string(ai));
22
+ ai = ai + 1;
23
+ };
24
+
25
+ print("part 2 done\n");
26
+
27
+ ai = 0_u64;
28
+ while ai < 100 {
29
+ v = v.pop().first;
30
+ ai = ai + 1;
31
+ };
32
+
33
+ print("part 3 done\n");
34
+
35
+ # should have shrunk from the pop() s
36
+ assert(v.capacity < last-cap);
37
+ last-cap = v.capacity;
38
+
39
+ ai = 0_u64;
40
+ for x in v.iter() {
41
+ assert(x == to-smart-string(ai));
42
+ ai = ai + 1;
43
+ };
44
+
45
+ print("part 4 done\n");
46
+
47
+
You can’t perform that action at this time.
0 commit comments