このコードがファイルをどのように変換するかを理解しようとしています
contents <- readFile "graph.txt"
let graph = readGraph contents
readGraph = transpose . str2int . map words . lines
str2int = map.map $ zero2inf . fromIntegral . (\xs -> read xs :: Int)
zero2inf x = if x == 0 then 1/0 else x
実際のtxtファイルには次の情報が含まれています
0 0 0 0 0
8 0 0 0 0
15 13 0 0 0
9 1 8 0 0
1 9 6 1 0
コードが実行された後のデータがどのように見えるかを誰かが説明してくれますか? またはそれは何ですか??
ここで重要な行は
readGraph = transpose . str2int . map words . lines