Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
import Network.Browser
|
||||
import Network.HTTP
|
||||
import Network.URI
|
||||
import Data.List
|
||||
import Data.Maybe
|
||||
import Text.XML.Light
|
||||
import Control.Arrow
|
||||
import Data.Char
|
||||
|
||||
getRespons url = do
|
||||
rsp <- Network.Browser.browse $ do
|
||||
setAllowRedirects True
|
||||
setOutHandler $ const (return ()) -- quiet
|
||||
request $ getRequest url
|
||||
return $ rspBody $ snd rsp
|
||||
|
||||
replaceWithSpace c = (\x -> if c==x then ' ' else x)
|
||||
|
||||
encl = chr 34
|
||||
|
||||
unimpTasks lang = do
|
||||
allTasks <- getRespons "http://www.rosettacode.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Programming_Tasks&cmlimit=500&format=xml"
|
||||
impl <- getRespons ( "http://rosettacode.org/json/isb/" ++ lang ++ ".json")
|
||||
let langxx = map (map(replaceWithSpace '_')) $ filter (/=",") $ words $ map (replaceWithSpace encl ) $ init $ drop 1 impl
|
||||
xml = onlyElems $ parseXML allTasks
|
||||
allxx = concatMap (map (fromJust.findAttr (unqual "title")). filterElementsName (== unqual "cm")) xml
|
||||
mapM_ putStrLn $ sort $ allxx \\ langxx
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import Network.HTTP
|
||||
import Data.Text (splitOn, pack, unpack)
|
||||
import Data.List
|
||||
|
||||
getTasks :: String -> IO [String]
|
||||
getTasks url = do
|
||||
resp <- simpleHTTP (getRequest url)
|
||||
body <- getResponseBody resp
|
||||
return $ tail $ map (unpack . head . splitOn (pack "\"}")) $ splitOn (pack "\"title\":\"") (pack body)
|
||||
|
||||
main :: String -> IO ()
|
||||
main lang = do
|
||||
implTasks <- getTasks $ "http://rosettacode.org/mw/api.php?action=query&list=categorymembers&cmtitle=Category:" ++ lang ++ "&format=json&cmlimit=500"
|
||||
allTasks <- getTasks "http://rosettacode.org/mw/api.php?action=query&list=categorymembers&cmtitle=Category:Programming_Tasks&format=json&cmlimit=500"
|
||||
mapM_ putStrLn $ allTasks \\ implTasks
|
||||
Loading…
Add table
Add a link
Reference in a new issue