I was experimenting with a coroutine example which i got from the c2 website. see link below for code.
http://paste.call-cc.org/paste?id=cf4489b9de4820b330dc34371ea3b73a18115a4b#a0I get the expected output when I run the code using csi
$ csi -ns coroutines.scm
HELLO!
WORLD!However when i run the executable which i compiled with csc, i get the following unexpected output. Please let me know what I am doing wrong.
$ csc coroutines.scm
$ ./coroutines
HELLO!
WORLD!
SORRY, I'M OUT
Error: dead-coroutine
Call history:
coroutines.scm:32: yield
coroutines.scm:15: call/cc
coroutines.scm:16: return
coroutines.scm:39: test-coroutine-1
coroutines.scm:12: call/cc
coroutines.scm:17: current
coroutines.scm:33: display
coroutines.scm:34: yield
coroutines.scm:15: call/cc
coroutines.scm:16: return
coroutines.scm:39: test-coroutine-1
coroutines.scm:12: call/cc
coroutines.scm:17: current
coroutines.scm:35: display
coroutines.scm:39: test-coroutine-1
coroutines.scm:10: error <--