about summary refs log tree commit diff stats
path: root/continuation4.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 /continuation4.mu
parent8846a7f85cc04b77b2fe8a67b6d317723437b00c (diff)
downloadmu-6e1eeeebfb453fa7c871869c19375ce60fbd7413.tar.gz
5485 - promote SubX to top-level
Diffstat (limited to 'continuation4.mu')
-rw-r--r--continuation4.mu47
1 files changed, 0 insertions, 47 deletions
diff --git a/continuation4.mu b/continuation4.mu
deleted file mode 100644
index 1a523fe9..00000000
--- a/continuation4.mu
+++ /dev/null
@@ -1,47 +0,0 @@
-# Example program showing 'return-continuation-until-mark' return other values
-# alongside continuations.
-#
-# Print out a given list of numbers.
-#
-# To run:
-#   $ git clone https://github.com/akkartik/mu
-#   $ cd mu
-#   $ ./mu continuation4.mu
-#
-# Expected output:
-#   1
-#   2
-#   3
-
-def main [
-  local-scope
-  l:&:list:num <- copy null
-  l <- push 3, l
-  l <- push 2, l
-  l <- push 1, l
-  k:continuation, x:num, done?:bool <- call-with-continuation-mark 100/mark, create-yielder, l
-  {
-    break-if done?
-    $print x 10/newline
-    k, x:num, done?:bool <- call k
-    loop
-  }
-]
-
-def create-yielder l:&:list:num -> n:num, done?:bool [
-  local-scope
-  load-inputs
-  {
-    done? <- equal l, null
-    break-if done?
-    n <- first l
-    l <- rest l
-    return-continuation-until-mark 100/mark, n, done?
-    loop
-  }
-  # A function that returns continuations shouldn't get the opportunity to
-  # return. Calling functions should stop calling its continuation after this
-  # point.
-  return-continuation-until-mark 100/mark, -1, done?
-  assert false, [called too many times, ran out of continuations to return]
-]