This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = (function () { | |
/* | |
This is my attempt at implementing a C#/Dart style async/await feature. | |
This is just a learning exercise, and I probably wouldn't use it in | |
production sites. | |
This code is broken: when await is called, not only is the program blocked | |
("called expensice function" is never written to the console), the Promise | |
doesn't actually execute its 'then' callback. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "dart:io"; | |
import "dart:convert"; | |
int main() async { | |
Map<int, List<int>> nodes = {}; | |
int maxNodes = null; | |
List<int> emptyNode() => new List<int>.filled(maxNodes, 0); | |
// initialises node if it doesn't yet exist | |
List<int> node(int i) { |