WASHã使ã
ã¨ããããã§ãWASHã使ããããã«ãªã£ãã®ã§ã
ä½ãä½ã£ã¦ã¿ããã¨ãããã¨ã§ãããªã¼å¼BBSãä½ã£ã¦ã¿ãã
http://fxp.infoseek.ne.jp/tmp/bbs/Main.hs
å¤ããã¢ã¯ã»ã¹ã§ããLinuxãµã¼ãã¼ãç¡ãã®ã§ã
å®éã«ã©ã®ããã«åãã®ãããè¦ãã§ããªãã®ãæ®å¿µã ãã
ã¾ããæ®éã«åãã¦ããã
ã¨ãã«ãããã使ã£ã¦ãã¦äºã¤ã»ã©åé¡ç¹ã«ééããã
ã¾ãã²ã¨ã¤ãããã¯åã«Haskellã®åé¡ã ãã
hoge = do dat <- readFile "hoge" let newdat = process dat writeFile "hoge" newdat
ãããæå³ããã¨ããã«åããªãã
ãã¡ããæå³ã¯hogeã¨ãããã¡ã¤ã«ã®ä¸èº«ã«processã¨ããé¢æ°ããã¾ãããã®ã ãã
ããã¯writeFileã§ãããã
fileãã¾ã ã¯ãã¼ãºããã¦ããªãã¨ãããã¨ã§ã
æãã¬ã¨ããã§é
延IOã®å¼å®³ãåºã¦ããå½¢ã ã
ãã¨ãã£ã¦ã
hoge = do h <- openFile "hoge" ReadMode dat <- hGetContents h hClose dat let newdat = process dat writeFile "hoge" newdat
ããããããªãã
ãã¡ã¤ã«ã®ä¸èº«ãã²ã¨ã¤ãèªã¿è¾¼ã¾ããªããã¡ã«ã¯ãã¼ãºãããããã ã
ãããã©ãããã°ããã®ï¼
ã¨ãããã¨ã§ãããããèãã¦
hoge = do h <- openFile "hoge" ReadMode dat <- hGetContents h length dat `seq` hClose dat hClose dat let newdat = process dat writeFile "hoge" newdat
ããããã¨ä½ã¨ããã¾ãåããã
ããããå
¥åãæååã¨ãã¦æ±ããããªãã¨ãã
ã¤ã¾ãã
hoge = do h <- openFile "hoge" ReadMode dat <- hGetContents h hClose dat let newdat = process $ read dat writeFile "hoge" $ show newdat
ãªã©ã¨ãããã¨ãã¯ãã¾ããããªãã£ãã
(ä½ã§ãã¯ããããããªãã)
ããããããã§ãçµå±ã©ã®ããã«ãããã¨ããã¨ã
hGetContentsã®é
延ããªãçãèªåã§ä½ããã¨ã«ããã
ãããããç¨æãã¦ããã¦ã»ãããããªæ°ããããã
ã¾ãããããªã«å¤§å¤ãªãã®ã§ããªãã®ã§ã
å¥ã«è¯ãã®ãããããªãã
ããã²ã¨ã¤ã¯ãWASHããã¼ã¸ã«åãè¾¼ããã¼ã¿ã
ãã¼ã¸ã®å¼ã³åºãã¬ãã«ãæ·±ããªãã«ã¤ãã©ãã©ãã§ãããªã£ã¦ãããã¨ã
ããã¨ãä¸ç»é¢ã®Submitãã¿ã³ã®æ°ãå¢ãã¦ãççºçã«ãã¼ã¿ãã§ãããªãã
ããããã¼ã¸ã«è¡¨ç¤ºãããã¿ã¤ãã«ã®æ°ã10åãããã§
ä»å ããããã¼ã¿ã¯20KBãããã
ããã10åãããå帰ããã200KBã«ããªãã
ããã¯å°å¸¸ã§ã¯ãªãæ°ã ã
ã©ãããWASHã¯ç¶ç¶ãä¿åããéã«interaction logãæ®ããããã®ã ãã
ãããå¼ã³åºããã¨ã«ã©ãã©ãã§ãããªãã
ããã¯å°ã£ãã
ã©ããããµã¤ãºãæããããã®æ¹æ³ããããããªã®ã ãã
ããããããªãã£ãã
ãããã¾ã§å®ç¨ã«ã¯ä½¿ããªãã大å¤ã ã