Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
import System.Environment
|
||||
import Control.Concurrent
|
||||
import Control.Monad
|
||||
|
||||
sleepSort :: [Int] -> IO ()
|
||||
sleepSort values = do
|
||||
chan <- newChan
|
||||
forM_ values (\time -> forkIO (threadDelay (50000 * time) >> writeChan chan time))
|
||||
forM_ values (\_ -> readChan chan >>= print)
|
||||
|
||||
main :: IO ()
|
||||
main = getArgs >>= sleepSort . map read
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import System.Environment
|
||||
import Control.Concurrent
|
||||
import Control.Concurrent.Async
|
||||
|
||||
sleepSort :: [Int] -> IO ()
|
||||
sleepSort = mapConcurrently_ (\x -> threadDelay (x*10^4) >> print x)
|
||||
|
||||
main :: IO ()
|
||||
main = getArgs >>= sleepSort . map read
|
||||
Loading…
Add table
Add a link
Reference in a new issue