all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,15 @@
|
|||
#lang racket
|
||||
|
||||
;; accepts a list to sort
|
||||
(define (sleep-sort lst)
|
||||
(define done (make-channel))
|
||||
(for ([elem lst])
|
||||
(thread
|
||||
(λ ()
|
||||
(sleep elem)
|
||||
(channel-put done elem))))
|
||||
(for/list ([_ (length lst)])
|
||||
(channel-get done)))
|
||||
|
||||
;; outputs '(2 5 5 7 8 9 10)
|
||||
(sleep-sort '(5 8 2 7 9 10 5))
|
||||
Loading…
Add table
Add a link
Reference in a new issue