blob: e661a7397361555e55a56df0c87d21a80facdee8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
function cons(v, ls) {
return { n : ls, v : v };
}
function callAll(ls) {
for (; ls; ls = ls.next)
ls.v();
}
function sc(v) {
return {v : v, h : null};
}
function sv(s, v) {
s.v = v;
callAll(s.h);
}
function ss(s) {
return s;
}
function sr(v) {
return {v : v, h : null};
}
function sb(x,y) {
var z = y(x.v);
var s = {v : z.v, h : null};
function reZ() {
z.h = cons(function() { s.v = z.v; callAll(s.h); }, z.h);
}
x.h = cons(function() { z = y(x.v); reZ(); s.v = z.v; callAll(s.h); }, x.h);
reZ();
return s;
}
function dyn(s) {
var x = document.createElement("span");
x.innerHTML = s.v;
document.body.appendChild(x);
s.h = cons(function() { x.innerHTML = s.v }, s.h);
}
function ts(x) { return x.toString() }
|