coroutines added by anadamide on Tue Apr 19 16:10:15 2016

(let* ((things '(a b c d e f))
       (refs '(1 0 3 1 4 4 5))
       (a (lambda (cc)
	    (let loop ()
	      (if (not (eq? refs '()))
		  (let ()
		    (display (list-ref things (car refs)))
		    (set! refs (cdr refs))
		    (set! cc (call/cc cc))
		    (loop))))))
       (b (lambda (cc)
	    (let loop ()
	      (if (not (eq? refs '()))
		  (let ()
		    (display (list-ref things (car refs)))
		    (set! refs (cdr refs))
		    (set! cc (call/cc cc))
		    (loop)))))))
  (a b))

#|so this prints badbeef, I would like to have a generator G, that does not contain the ordered list of outputs, and instead wraps up the coroutines, and lets you both yeild from them, and resume the co-routines on each call to the generator. such that calling (list (G)(G)(G)(G)(G)(G)(G)) will return (b a d b e e f)|#