Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -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

View file

@ -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