about summary refs log tree commit diff stats
path: root/archive/1.vm.arc/tangle.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-01-01 17:04:37 -0800
committerKartik Agaram <vc@akkartik.com>2020-01-01 17:04:37 -0800
commit2a4088119cf41175457414dfa59bd4064b8f0562 (patch)
tree64fe184e399f9870ebd481a90eec34d51e5dff68 /archive/1.vm.arc/tangle.mu
parent23fd294d85959c6b476bcdc35ed6ad508cc99b8f (diff)
downloadmu-2a4088119cf41175457414dfa59bd4064b8f0562.tar.gz
5852
Diffstat (limited to 'archive/1.vm.arc/tangle.mu')
-rw-r--r--archive/1.vm.arc/tangle.mu35
1 files changed, 0 insertions, 35 deletions
diff --git a/archive/1.vm.arc/tangle.mu b/archive/1.vm.arc/tangle.mu
deleted file mode 100644
index 3e73dd89..00000000
--- a/archive/1.vm.arc/tangle.mu
+++ /dev/null
@@ -1,35 +0,0 @@
-; To demonstrate tangle directives, we'll construct a factorial function with
-; separate base and recursive cases. Compare factorial.mu.
-; This isn't a very realistic example, just a simple demonstration of
-; possibilities.
-
-(function factorial [
-  (default-space:space-address <- new space:literal 30:literal)
-  (n:integer <- next-input)
-  { begin
-    base-case
-  }
-  recursive-case
-])
-
-(after base-case [
-  ; if n=0 return 1
-  (zero?:boolean <- equal n:integer 0:literal)
-  (break-unless zero?:boolean)
-  (reply 1:literal)
-])
-
-(after recursive-case [
-  ; return n*factorial(n-1)
-  (x:integer <- subtract n:integer 1:literal)
-  (subresult:integer <- factorial x:integer)
-  (result:integer <- multiply subresult:integer n:integer)
-  (reply result:integer)
-])
-
-(function main [
-  (1:integer <- factorial 5:literal)
-  ($print (("result: " literal)))
-  (print-integer nil:literal/terminal 1:integer)
-  (print-character nil:literal/terminal ((#\newline literal)))
-])
<vc@akkartik.com> 2015-05-23 17:58:10 -0700 1444' href='/akkartik/mu/commit/036call_ingredient.cc?h=main&id=50eab110e81f6f82a00a9eb7d87ccedd3697cfd3'>50eab110 ^
69f04c3f ^
3eeea0a2 ^
6c96a437 ^
67573caf ^
3473c63a ^
c9a5a7ba ^
016599f1 ^
78a12c9d ^
1fa53058 ^
69f04c3f ^
1848b18f ^

69f04c3f ^
795f5244 ^
4a48bedc ^
166e3c0d ^
69f04c3f ^
166e3c0d ^
2b250717 ^
e4630643 ^

166e3c0d ^



31401373 ^
67573caf ^
3473c63a ^
c9a5a7ba ^
3a982057 ^


78c50205 ^
9dcbec39 ^
3a982057 ^
81c87f08 ^

53ba69a7 ^
691b529e ^
1fa53058 ^
0487a30e ^
67573caf ^
ac0e9db5 ^
0487a30e ^
67573caf ^
69f04c3f ^
4be9a93b ^
3e849f11 ^
9dcbec39 ^
75aa3a98 ^
0487a30e ^
75aa3a98 ^
2d29369f ^
0487a30e ^
4be9a93b ^
69f04c3f ^

717ab659 ^
4a943d4e ^














3e849f11 ^
4a943d4e ^


















717ab659 ^



795f5244 ^
4a48bedc ^
166e3c0d ^



717ab659 ^

67573caf ^
717ab659 ^


23d3a022 ^

4a943d4e ^















717ab659 ^



795f5244 ^
4a48bedc ^
166e3c0d ^
717ab659 ^
166e3c0d ^
2b250717 ^
e4630643 ^

5f98a10c ^
9dcbec39 ^
e4630643 ^

166e3c0d ^



b24eb476 ^
67573caf ^
0487a30e ^
67573caf ^
ac0e9db5 ^
827898fc ^
67573caf ^
717ab659 ^

ac0e9db5 ^
0487a30e ^

827898fc ^
717ab659 ^



c9a5a7ba ^
78c50205 ^
c9a5a7ba ^
78c50205 ^

c9a5a7ba ^
af023b32 ^

1fb0cf9e ^
af023b32 ^


1fb0cf9e ^
af023b32 ^
93d4cc93 ^
1fb0cf9e ^
93d4cc93 ^
c9a5a7ba ^
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220