• 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óna61be0ee5cb44a56b79e7beed0ea5cd734a1fa18 (tree)
Tiempo2022-10-18 10:31:27
AutorCorbin <cds@corb...>
CommiterCorbin

Log Message

Many animations work in Honey!

deco-circles, red-ellipse, and max-headroom all work! jupiter-storm is
still giving a blank screen, but it seems like the fundamentals are
finally there.

We are currently pegging the CPU at 5 frames/s. I would like to
eventually get to about 20 frames/s.

Cambiar Resumen

Diferencia incremental

--- a/honey/static/honey.js
+++ b/honey/static/honey.js
@@ -37,9 +37,10 @@ class Extractor {
3737 }
3838 }
3939
40-function fixNaN(x) { return isNaN(x) ? [false, null] : [true, x]; }
40+function fixNaN(x) {
41+ return isNaN(x) ? Cammy.right(Cammy.ignore(null)) : Cammy.left(x);
42+}
4143 function rescueNaN(f) { return x => fixNaN(f(x)); }
42-function rescueNaN2(f) { return xy => fixNaN(f(Cammy.fst(xy), Cammy.snd(xy))); }
4344
4445 const prims = {
4546 "id": Cammy.id,
@@ -54,8 +55,8 @@ const prims = {
5455 "f": _ => false,
5556 "not": b => !b,
5657 "either": Cammy.either,
57- "disj": ([b, c]) => b || c,
58- "conj": ([b, c]) => b && c,
58+ "disj": bc => Cammy.fst(bc) || Cammy.snd(bc),
59+ "conj": bc => Cammy.fst(bc) && Cammy.snd(bc),
5960 "zero": _ => 0,
6061 "succ": n => n + 1,
6162 "n-add": xy => Cammy.natAdd(Cammy.fst(xy))(Cammy.snd(xy)),
@@ -68,13 +69,13 @@ const prims = {
6869 "f-add": xy => Cammy.fst(xy) + Cammy.snd(xy),
6970 "f-mul": xy => Cammy.fst(xy) * Cammy.snd(xy),
7071 "f-negate": x => -x,
71- "f-recip": rescueNaN(x => 1 / x),
72+ "f-recip": x => 1 / x,
7273 "f-sign": x => x <= -0.0,
7374 "f-floor": rescueNaN(Math.floor),
7475 "f-sqrt": rescueNaN(Math.sqrt),
7576 "f-lt": xy => Cammy.fst(xy) < Cammy.snd(xy),
76- "f-sin": rescueNaN(Math.sin),
77- "f-cos": rescueNaN(Math.cos),
77+ "f-sin": x => Number.isFinite(x) ? Math.sin(x) : 0.0,
78+ "f-cos": x => Number.isFinite(x) ? Math.cos(x) : 0.0,
7879 "f-atan2": yx => Math.atan2(Cammy.fst(yx), Cammy.snd(yx)),
7980 };
8081 function compile(expr) {
@@ -196,7 +197,6 @@ function tileForIndex(extractor, index, title, trail) {
196197 const canvas = document.createElement("canvas");
197198 canvas.width = 100; canvas.height = 100;
198199 div.appendChild(canvas);
199- Cammy.runTrampoline(compiled(Cammy.makePair(0)(0)));
200200 drawFrame(canvas, (x, y) => Cammy.runTrampoline(compiled(Cammy.makePair(x)(y))), getChannels);
201201 } else {
202202 div.innerHTML += "Not sure how to display this image yet.";
@@ -208,6 +208,8 @@ function tileForIndex(extractor, index, title, trail) {
208208 const canvas = document.createElement("canvas");
209209 canvas.width = 100; canvas.height = 100;
210210 div.appendChild(canvas);
211+ console.log("test run",
212+ Cammy.runTrampoline(compiled(Cammy.makePair(Cammy.makePair(0)(0))(0))));
211213 let start;
212214 function stepFrame(timestamp) {
213215 if (start === undefined) { start = timestamp; }
@@ -215,7 +217,7 @@ function tileForIndex(extractor, index, title, trail) {
215217 drawFrame(canvas, (x, y) => {
216218 return Cammy.runTrampoline(compiled(Cammy.makePair(Cammy.makePair(x)(y))(t)));
217219 }, getChannels);
218- setTimeout(() => window.requestAnimationFrame(stepFrame), 1000);
220+ setTimeout(() => window.requestAnimationFrame(stepFrame), 200);
219221 }
220222 window.requestAnimationFrame(stepFrame);
221223 } else {