8 lines
258 B
Haskell
8 lines
258 B
Haskell
|
|
buildPaths d = mapWithKey (\pair s -> s { path = buildPath pair}) d
|
||
|
|
where
|
||
|
|
buildPath (i,j)
|
||
|
|
| i == j = [[j]]
|
||
|
|
| otherwise = do k <- path $ fromJust $ lookup (i,j) d
|
||
|
|
p <- buildPath (k,j)
|
||
|
|
[i : p]
|