This file contains hidden or 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 SequenceRule = function() { | |
| var parts = arguments; | |
| if(!parts.length) return function(phase, onmatch, onfail) { | |
| return onmatch(phase, '') | |
| } | |
| var last = parts[parts.length - 1]; | |
| var trailing = function(phase, onmatch, onfail){ | |
| last(phase, function(phase1, result){ onmatch(phase1, [result]) }, onfail) | |
| }; | |
| for(var j = parts.length - 2; j >= 0; j--) { |
This file contains hidden or 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
| [semantics [or a b] | |
| [let [ta [evaluate a]] | |
| [if ta [return ta] [return [evaluate b]]]]] | |
| [semantics [while condition body] | |
| [block LOOP_START | |
| [let [continue? [evaluate condition]] | |
| [if continue? | |
| [begin | |
| [evaluate body] |
This file contains hidden or 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 Ref = function(s){ this.ref = s } | |
| var newt = function(n){ | |
| return function(){ | |
| return new Ref("_" + (n++)) | |
| } | |
| }(0); | |
| function id(x){ return x } | |
| function normalizeTerm(form){ return normalize(form, id) } | |
| function normalize(form, ctx){ |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| </body> | |
| </html> |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| </body> | |
| </html> |
This file contains hidden or 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 H = 3 | |
| var Η = 2 | |
| console.log(Η + H) // 5 |
This file contains hidden or 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
| function interpret(form, env, k){ | |
| if(form instanceof Array){ | |
| switch(form[0]){ | |
| case 'lambda': { | |
| var params = form[1]; | |
| var body = form[2]; | |
| return k(function(k){ return function() { | |
| var e = Object.create(env); | |
| for(var j = 0; j < params.length; j++) | |
| e[params[j]] = arguments[j]; |
This file contains hidden or 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
| // noprotect | |
| function Lambda(param, body, e){ | |
| this.param = param | |
| this.body = body | |
| this.env = e | |
| }; | |
| Lambda.prototype.apply = function(t, args, k0){ | |
| var e_ = Object.create(this.env); | |
| for(var j = 0; j < this.param.length; j++){ | |
| e_[this.param[j]] = args[j]; |
This file contains hidden or 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 upm = 1000; | |
| function Point(x, y, on, interpolated){ | |
| this.xori = x; | |
| this.yori = y; | |
| this.xtouch = x; | |
| this.ytouch = y; | |
| this.touched = false; | |
| this.donttouch = false; | |
| this.on = on; |
This file contains hidden or 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
| function $(C,E,K){if(!(C instanceof Array))return K("string"==typeof C? | |
| E[C]:C);switch(C[0]){case"lambda":return K(function(K){return function( | |
| ){for(var e=Object.create(E),u=0;u<C[1].length;u++)e[C[1][u]]=arguments | |
| [u];return $(C[2],e,K)}});case"if":return $(C[1],E,function(e){return e | |
| ?$(C[2],E,K):$(C[3],E,K)});case"callcc":return $(C[1],E,function(C){var | |
| E=function(){return function(C){return K(C)}};return C(E)(E)});case "'" | |
| :return K(C[1]);default:return $c(C,E,K)}}function $c(C,E,K){return $(C | |
| [0],E,function(e){return $$(C.slice(1),E,function(C){return e(K).apply( | |
| null,C)})})}; function $$(C,E,K) {return C.length?$(C[0],E,function(e){ | |
| return $$(C.slice(1),E,function(C){return K(C?[e]:[e].concat(C))})}):K( |