rsc3/doc/help/unsorted/poll.scm

10 lines
314 B
Scheme
Raw Permalink Normal View History

2022-08-24 13:53:18 +00:00
; poll
(with-sc3
(lambda (fd)
(letrec ((print (lambda (e) (display e) (newline)))
(showing (lambda (f) (lambda () (let ((v (f))) (print v) v))))
(repeat (lambda (f) (if (f) (repeat f) #f))))
(async fd (notify 1))
(repeat (showing (lambda () (wait fd "/tr"))))
(async fd (notify 0)))))