• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A categorical programming language


Commit MetaInfo

Revisión1531cf447f5e70bb057715d9a060945323a839ad (tree)
Tiempo2022-10-10 03:31:36
AutorCorbin <cds@corb...>
CommiterCorbin

Log Message

Stop fucking around with the trampoline for now.

Cambiar Resumen

Diferencia incremental

--- a/honey/static/honey.js
+++ b/honey/static/honey.js
@@ -39,7 +39,7 @@ function rescueNaN(f) { return isNaN(f) ? [true, f] : [false, null]; }
3939 // X -> Tramp X
4040 function done(result) { return ["pure", result]; }
4141 // [1,Tramp X] -> Tramp X
42-// function cont(thunk) { return ["cont", thunk]; }
42+function cont(thunk) { return ["cont", thunk]; }
4343 // Tramp X × [X,Tramp Y] -> Tramp Y
4444 function bind(action, f) { return ["bind", action, f]; }
4545 // function join(action) { return cont(() => bind(action, ma => ma)); }
@@ -63,9 +63,9 @@ function trampoline(action) {
6363 stack = [register[2], stack];
6464 register = register[1];
6565 break;
66- // case "cont":
67- // register = register[1]();
68- // break;
66+ case "cont":
67+ register = register[1]();
68+ break;
6969 default:
7070 console.log("stack", stack);
7171 throw new Error("unknown trampoline action " + register[0]);
@@ -122,13 +122,13 @@ function compile(expr) {
122122 }
123123 case "curry": {
124124 const [f] = l;
125- // XXX messy?
126- return x => done(y => trampoline(f([x, y])));
125+ // XXX slightly wrong...
126+ return x => done(y => f([x, y]));
127127 }
128128 case "uncurry": {
129129 const [f] = l;
130- // XXX should use cont?
131- return ([x, y]) => bind(f(x), g => done(g(y)));
130+ // XXX ...but also wrong here
131+ return ([x, y]) => bind(f(x), g => cont(() => g(y)));
132132 }
133133 case "pr": {
134134 const [z, s] = l;