123456789101112131415161718192021222324 |
- (import (except (rnrs base) error)
- (only (guile)
- lambda* λ
- simple-format)
- ;; fibers
- (fibers)
- (fibers channels))
- (define call-with-channel-input-string
- (λ (string proc)
- (let ([chan (make-channel)])
- (spawn-fiber (λ () (proc chan)))
- (put-message chan string)
- (simple-format #t "wrote message to channel: ~a\n" string))))
- (run-fibers
- (λ ()
- (call-with-channel-input-string
- "Hello!"
- (λ (channel)
- (simple-format #t "received message: ~a\n" (get-message channel))))))
|