0085デフォルトの名無しさん
2017/06/25(日) 18:17:18.21ID:pYBZiqDJreplace [] _ cs = cs
replace w nw cs | w == xs = nw ++ replace w nw ys
where
(xs,ys) = splitAt (length w) cs
replace w nw (c:cs) = c:replace w nw cs
putfc (f,c) = printf "%s\n%s" f c
writefc (f,c) = writeFile f c
mfptn fs f ofs output = mapM readFile fs >>=
return.(zip ofs).map f >>=
mapM_ output
mfput f fs = mfptn fs f (map bluestr fs) putfc
mfwrite f fs = let tfs = map (++ ".temp") fs in
mfptn fs f tfs writefc >>
mfptn tfs id fs writefc