Skip to content

Commit

Permalink
update gwion snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecdjay committed Oct 14, 2022
1 parent a499be5 commit 98b2f5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/binary-trees.gw
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

class final Tree {
var int item;
late Tree left, right;
late Tree left;
late Tree right;

operator new(int it, int depth) {
it :=> item;
Expand Down Expand Up @@ -33,7 +34,7 @@ new Tree(0, maxDepth) :=> var Tree longLivedTree;
#! iterations = 2 ** maxDepth
1 :=> var int iterations;
for (var int d; d < maxDepth; ++d)
2 *:=> iterations;
2 *=> iterations;

minDepth :=> var int depth;
while (depth < stretchDepth) {
Expand Down
2 changes: 1 addition & 1 deletion src/for.gw
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var int list[0];
var int[0] list;

for (var int i; i < 1000000; ++i)
list << i;
Expand Down
3 changes: 2 additions & 1 deletion src/method-call.gw
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class Toggle {
}

class NthToggle extends Toggle {
var int count, countMax;
var int count;
var int countMax;
fun Toggle activate() {
if(++count >= countMax) {
(this $ Toggle).activate();
Expand Down

0 comments on commit 98b2f5b

Please sign in to comment.