# Mu - continuation1.mu

     1 # Example program showing that 'return-continuation-until-mark' can 'pause' a
     2 # function call, returning a continuation, and that calling the continuation
     3 # can 'resume' the paused function call.
     4 #
     5 # To run:
     6 #   $ git clone https://github.com/akkartik/mu
     7 #   $ cd mu
     8 #   $ ./mu continuation1.mu
     9 #
    10 # Expected output:
    11 #   1
    12
    13 def main [
    14   local-scope
    15   k:continuation <- call-with-continuation-mark 100/mark, create-yielder
    16   x:num <- call k  # should return 1
    17   $print x 10/newline
    18 ]
    19
    20 def create-yielder -> n:num [
    21   local-scope
    22   load-inputs
    23   return-continuation-until-mark 100/mark
    24   return 1
    25 ]