eval(readFile("Worlds_Compiled")) gensym = function() { gensym.count = gensym.count + 1 return "_gensm_" + gensym.count } gensym.count = 0 scope scope.has("foo") scope.has("gensym") scope.get("gensym") scope.decl("bar", "baz") bar scopeProto.unify = function(x, v) { if (this.has(x) && this.get(x) !== v) abort else return this.decl(x, v) } father = function(x, y, s, k) { try { s.unify(x, "abe"); s.unify(y, "homer"); k(s) } else { try { s.unify(x, "homer"); s.unify(y, "bart"); k(s) } else { try { s.unify(x, "homer"); s.unify(y, "lisa"); k(s) } else {}}} } grandfather = function(x, y, s, k) { try { var z = gensym(); father(x, z, s, function(s) { father(z, y, s, k) }) } else {} } father("a", "b", scope, function() { if (confirm("a=" + a + ", b=" + b + "\n\nmore results?")) abort }) grandfather("c", "d", scope, function() { if (confirm("c=" + c + ", d=" + d + "\n\nmore results?")) abort })