Can I have a co-routine of three functions using continuations in Scheme?

From "The Scheme Programming Language scheme.com/tspl4/further.html#./further%... (define lwp-list '()) ; SO's highlighter gets confused (define lwp (lambda (thunk) (set! Lwp-list (append lwp-list (list thunk))))) (define start (lambda () (let (p (car lwp-list)) (set! Lwp-list (cdr lwp-list)) (p)))) (define pause (lambda () (call/cc (lambda (k) (lwp (lambda () (k #f))) (start))))) (lwp (lambda () (let f () (pause) (display "h") (f)))) (lwp (lambda () (let f () (pause) (display "e") (f)))) (lwp (lambda () (let f () (pause) (display "y") (f)))) (lwp (lambda () (let f () (pause) (display "!") (f)))) (lwp (lambda () (let f () (pause) (newline) (f)))) (start) hey!

.

From "The Scheme Programming Language" scheme.com/tspl4/further.html#./further%... (define lwp-list '()) ; SO's highlighter gets confused (define lwp (lambda (thunk) (set! Lwp-list (append lwp-list (list thunk))))) (define start (lambda () (let (p (car lwp-list)) (set! Lwp-list (cdr lwp-list)) (p)))) (define pause (lambda () (call/cc (lambda (k) (lwp (lambda () (k #f))) (start))))) (lwp (lambda () (let f () (pause) (display "h") (f)))) (lwp (lambda () (let f () (pause) (display "e") (f)))) (lwp (lambda () (let f () (pause) (display "y") (f)))) (lwp (lambda () (let f () (pause) (display "!") (f)))) (lwp (lambda () (let f () (pause) (newline) (f)))) (start) hey!

.

(define (puts . Lst) (map display lst) (newline)) (define (A some-fun more-fun) (let loop ((n 3)) (puts "In A with " some-fun " and " more-fun " and n=" n) (let-values (((s m) (call/cc (lambda (next-iter) (some-fun more-fun next-iter))))) (set! Some-fun s) (set!

More-fun m)) (when (> n 0) (loop (- n 1))))) (define (B some-fun more-fun) (let loop ((n 3)) (puts "In B with " some-fun " and " more-fun " and n=" n) (let-values (((s m) (call/cc (lambda (next-iter) (some-fun more-fun next-iter))))) (set! Some-fun s) (set! More-fun m)) (when (> n 0) (loop (- n 1))))) (define (C some-fun more-fun) (let loop ((n 3)) (puts "In C with " some-fun " and " more-fun " and n=" n) (let-values (((s m) (call/cc (lambda (next-iter) (some-fun more-fun next-iter))))) (set!

Some-fun s) (set! More-fun m)) (when (> n 0) (loop (- n 1))))) (A B C).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions