;; Stream-Netzwerke (define (combine proc in-1 in-2 out) (spawn (lambda () (let loop () (send-sync out (proc (receive-sync in-1) (receive-sync in-2))) (loop))))) (define (delay init in out) (spawn (lambda () (let loop ((message init)) (send-sync out message) (loop (receive-sync in)))))) (define (copy in out-1 out-2) (spawn (lambda () (let loop () (let ((message (receive-sync in))) (send-sync out-1 message) (send-sync out-2 message) (loop)))))) (define (make-fib-channel) (let ((out (make-sync-channel)) (c1 (make-sync-channel)) (c2 (make-sync-channel)) (c3 (make-sync-channel)) (c4 (make-sync-channel)) (c5 (make-sync-channel))) (delay 0 c4 c5) (copy c2 c3 c4) (combine + c3 c5 c1) (copy c1 c2 out) (send-sync c1 1) out))