/usr/share/racket/pkgs/unstable-lib/future.rkt is in racket-common 6.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #lang racket/base
(require racket/future
(for-syntax racket/base))
(provide for/async
for*/async)
;; Note: order of touches not guaranteed.
(define-syntaxes (for/async for*/async)
(let ()
(define ((transformer for/fold/derived-id) stx)
(syntax-case stx ()
[(_ (clause ...) . body)
(quasisyntax/loc stx
(let ([futures
(#,for/fold/derived-id #,stx ([fs null]) (clause ...)
(cons (future (lambda () . body)) fs))])
;; touches futures in original order
(let loop ([fs futures])
(cond [(pair? fs) (begin (loop (cdr fs)) (touch (car fs)))]
[else (void)]))))]))
(values (transformer #'for/fold/derived)
(transformer #'for*/fold/derived))))
|