author | Tony Garnock-Jones <tonyg@kcbbs.gen.nz> |
Sun, 18 Jan 2009 11:22:02 +0000 | |
changeset 221 | eb2506613052 |
parent 217 | 99d5b8250c37 |
child 224 | 91dca64bb782 |
permissions | -rw-r--r-- |
221
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
1 |
namespace s = "http://eighty-twenty.org/etng/r1/ns/stream#"; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
2 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
3 |
define raw_callcc fn -> |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
4 |
'%assemble' (fn = fn) { .scheme -> ('call-with-current-continuation' |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
5 |
(lambda (k) ('etng-send' fn k))) }; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
6 |
define callcc fn -> |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
7 |
raw_callcc { k -> fn {v -> '%assemble' (v = v, k = k) { .scheme -> (k v) } } }; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
8 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
9 |
define extend1 base extension -> |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
10 |
'%assemble' (base = base, extension = extension) { |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
11 |
.scheme -> ('etng-merge-functions' extension base); |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
12 |
}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
13 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
14 |
define :booleanBehaviour = [ |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
15 |
.not -> '%assemble' (x = self) { .scheme -> (not x) }; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
16 |
]; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
17 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
18 |
define :falseProxy = extend1 [v -> v.:false] :booleanBehaviour; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
19 |
define :trueProxy = extend1 [v -> v.:true] :booleanBehaviour; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
20 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
21 |
define < = .<; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
22 |
define > = .>; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
23 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
24 |
define :symbolProxy = [ |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
25 |
msg -> case self { |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
26 |
.< -> :messageAccumulator {receiver -> receiver msg}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
27 |
_ -> error("Cannot send message to symbol", msg); |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
28 |
}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
29 |
]; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
30 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
31 |
define :messageAccumulator firstSender -> [ |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
32 |
.> receiver -> firstSender receiver; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
33 |
secondMsg -> :messageAccumulator {receiver -> firstSender receiver secondMsg}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
34 |
]; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
35 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
36 |
define false = '%assemble' () { .scheme -> (not (quote nonfalse)) }; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
37 |
define true = false.not; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
38 |
|
217
99d5b8250c37
Compile to scheme and evaluate.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff
changeset
|
39 |
define + = .+; |
221
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
40 |
define * = .*; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
41 |
define == = .==; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
42 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
43 |
define eq x y -> '%assemble' (x = x, y = y) { .scheme -> ('eq?' x y) }; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
44 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
45 |
define write x -> '%assemble' (x = x) { .scheme -> (begin (write x) (newline)) }; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
46 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
47 |
define :eq = [ |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
48 |
.== other -> '%assemble' (a = self, b = other) { .scheme -> ('eqv?' a b) }; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
49 |
]; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
50 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
51 |
define case x options -> options x; |
217
99d5b8250c37
Compile to scheme and evaluate.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff
changeset
|
52 |
|
221
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
53 |
define :numberProxy = [ |
217
99d5b8250c37
Compile to scheme and evaluate.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff
changeset
|
54 |
.+ other -> '%assemble' (a = self, b = other) { .scheme -> (+ a b) }; |
221
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
55 |
.* other -> '%assemble' (a = self, b = other) { .scheme -> (* a b) }; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
56 |
.< other -> '%assemble' (a = self, b = other) { .scheme -> (< a b) }; |
217
99d5b8250c37
Compile to scheme and evaluate.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
diff
changeset
|
57 |
]; |
221
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
58 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
59 |
define s:empty = [ .s:case v -> v.s:empty ]; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
60 |
define s:cons(head, tail) -> [ .s:case v -> v.s:next(head, tail) ]; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
61 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
62 |
define :tupleProxy = [ |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
63 |
.length -> '%assemble' (v = self) { .scheme -> ('vector-length' v) }; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
64 |
.get(n) -> '%assemble' (v = self, n = n) { .scheme -> ('vector-ref' v n) }; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
65 |
.s:case v -> :tupleIterator(self, 0).s:case v; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
66 |
]; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
67 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
68 |
define :tupleIterator(tuple, index) -> |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
69 |
(index < (tuple.length)) { |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
70 |
.:true -> [.s:case v -> v.s:next(tuple.get(index), :tupleIterator(tuple, index + 1))]; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
71 |
.:false -> [.s:case v -> v.s:empty]; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
72 |
}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
73 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
74 |
define s:do stream fn -> |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
75 |
stream .s:case { |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
76 |
.s:empty -> .ok; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
77 |
.s:next(head, tail) -> do fn(head); s:do tail fn; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
78 |
}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
79 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
80 |
define s:foldl stream knil kons -> |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
81 |
stream .s:case { |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
82 |
.s:empty -> knil; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
83 |
.s:next(head, tail) -> s:foldl tail (kons(head, knil)) kons; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
84 |
}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
85 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
86 |
define s:foldr stream knil kons -> |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
87 |
stream .s:case { |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
88 |
.s:empty -> knil; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
89 |
.s:next(head, tail) -> kons(head, s:foldr tail knil kons); |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
90 |
}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
91 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
92 |
define s:reverse stream -> s:foldl (s:cons, s:empty) stream; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
93 |
define s:append(s1, s2) -> s:foldr (s:cons, s2) s1; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
94 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
95 |
define s:foldlK stream knil kons k -> |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
96 |
stream .s:case { |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
97 |
.s:empty -> k(knil); |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
98 |
.s:next(head, tail) -> kons (head, knil) {newSeed -> s:foldlK tail newSeed kons k}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
99 |
}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
100 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
101 |
define s:foldrK stream knil kons k -> |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
102 |
stream .s:case { |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
103 |
.s:empty -> k(knil); |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
104 |
.s:next(head, tail) -> s:foldr tail knil kons {newSeed -> kons (head, newSeed) k}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
105 |
}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
106 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
107 |
define s:concatenate stream -> s:foldr stream s:empty s:append; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
108 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
109 |
define s:map stream fn -> s:foldr stream s:empty {elt, acc -> s:cons(fn(elt), acc)}; |
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
110 |
|
eb2506613052
Identifier namespaces, and some interesting code for boot.tng.
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
parents:
217
diff
changeset
|
111 |
-- s:map (1, 2, 3) {x -> x}; |