about summary refs log tree commit diff stats
path: root/callcc.mu
blob: a08f9c8a71c0a775b9e418d598b9411b1679d7ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# example program: saving and reusing call-stacks or continuations

recipe main [
  c:continuation <- f
  continue-from c:continuation            # <-- ..when you hit this
]

recipe f [
  c:continuation <- g
  reply c:continuation
]

recipe g [
  c:continuation <- current-continuation  # <-- loop back to here
  $print 1:literal
  reply c:continuation  # threaded through unmodified after first iteration
]
terminal""" # Importing the main method may fail if the ranger directory # is neither in the same directory as this file, nor in one of # pythons global import paths. try: from ranger import main except ImportError: import sys if '-d' not in sys.argv and '--debug' not in sys.argv: print("Can't import the main module.") print("To run an uninstalled copy of ranger,") print("launch ranger.py in the top directory.") else: raise else: main()