about summary refs log tree commit diff stats
path: root/archive/2.vm/continuation3.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-07-27 16:01:55 -0700
committerKartik Agaram <vc@akkartik.com>2019-07-27 17:47:59 -0700
commit6e1eeeebfb453fa7c871869c19375ce60fbd7413 (patch)
tree539c4a3fdf1756ae79770d5c4aaf6366f1d1525e /archive/2.vm/continuation3.mu
parent8846a7f85cc04b77b2fe8a67b6d317723437b00c (diff)
downloadmu-6e1eeeebfb453fa7c871869c19375ce60fbd7413.tar.gz
5485 - promote SubX to top-level
Diffstat (limited to 'archive/2.vm/continuation3.mu')
-rw-r--r--archive/2.vm/continuation3.mu34
1 files changed, 34 insertions, 0 deletions
diff --git a/archive/2.vm/continuation3.mu b/archive/2.vm/continuation3.mu
new file mode 100644
index 00000000..cde60958
--- /dev/null
+++ b/archive/2.vm/continuation3.mu
@@ -0,0 +1,34 @@
+# Example program showing that a function call can be 'paused' multiple times,
+# creating different continuation values.
+#
+# To run:
+#   $ git clone https://github.com/akkartik/mu
+#   $ cd mu
+#   $ ./mu continuation3.mu
+#
+# Expected output:
+#   caller 0
+#   callee 0
+#   caller 1
+#   callee 1
+#   caller 2
+#   callee 2
+
+def main [
+  local-scope
+  $print [caller 0] 10/newline
+  k:continuation <- call-with-continuation-mark 100/mark, f
+  $print [caller 1] 10/newline
+  k <- call k
+  $print [caller 2] 10/newline
+  call k
+]
+
+def f [
+  local-scope
+  $print [callee 0] 10/newline
+  return-continuation-until-mark 100/mark
+  $print [callee 1] 10/newline
+  return-continuation-until-mark 100/mark
+  $print [callee 2] 10/newline
+]
oothj5@gmail.com> 2012-11-22 02:34:49 +0000 Added time to themes, and some example themes' href='/danisanti/profani-tty/commit/themes/original?id=45a26b111f8bdfe9fb534368eb29bb8963353d8a'>45a26b11 ^
30b5f112 ^
45a26b11 ^
45a26b11 ^
8a113ad6 ^
45a26b11 ^

d39bcdc1 ^
b21edfaa ^

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