Created
August 28, 2019 00:00
-
-
Save jgreco/147503479916d08e3efb6291678f6016 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (sync/vector evts-v) | |
(let ([sync-vec (build-vector (vector-length evts-v) | |
(lambda (n) | |
(wrap-evt | |
(vector-ref evts-v n) | |
(lambda (r) (cons n r)))))]) | |
(let loop () | |
(let ([remaining-evts (filter evt? (vector->list sync-vec))]) | |
(unless (empty? remaining-evts) | |
(let ([res (apply sync remaining-evts)]) | |
(vector-set! sync-vec (car res) (cdr res))) | |
(loop)))) | |
sync-vec)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment