home
/
code
/
tt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7839894
)
Test concurrent-filter-map
author
Siraaj Khandkar
<siraaj@khandkar.net>
Wed, 18 Nov 2020 13:27:40 +0000
(08:27 -0500)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Wed, 18 Nov 2020 13:27:40 +0000
(08:27 -0500)
tt.rkt
patch
|
blob
|
blame
|
history
diff --git
a/tt.rkt
b/tt.rkt
index
c606b2e
..
b691fd0
100644
(file)
--- a/
tt.rkt
+++ b/
tt.rkt
@@
-50,6
+50,7
@@
(struct feed (nick uri))
(define (concurrent-filter-map num_workers f xs)
(struct feed (nick uri))
(define (concurrent-filter-map num_workers f xs)
+ ; TODO preserve order of elements OR communicate that reorder is expected
; TODO switch from mailboxes to channels
(define (make-worker id f)
(define parent (current-thread))
; TODO switch from mailboxes to channels
(define (make-worker id f)
(define parent (current-thread))
@@
-83,6
+84,15
@@
(for-each thread-wait threads)
results)
(for-each thread-wait threads)
results)
+(module+ test
+ (define n-workers 10)
+ (define given (list
+ (λ (x) (if (even? x) x #f))
+ (range 11)))
+ (check-equal?
+ (sort (apply concurrent-filter-map (cons n-workers given)) <)
+ (sort (apply filter-map given ) <)))
+
(define (msg-print out-format odd msg)
(printf
(match out-format
(define (msg-print out-format odd msg)
(printf
(match out-format
This page took
0.031995 seconds
and
4
git commands to generate.