7 lines
258 B
Haskell
7 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]
|