Improve filesystem solution
This commit is contained in:
parent
67fbeab9a6
commit
ef1ff6c27a
1 changed files with 1 additions and 1 deletions
|
@ -95,7 +95,7 @@ findAll name = filesystem file dir
|
||||||
file :: Name -> Int -> [Path]
|
file :: Name -> Int -> [Path]
|
||||||
file n _ = if n == name then [[n]] else []
|
file n _ = if n == name then [[n]] else []
|
||||||
dir :: Name -> [[Path]] -> [Path]
|
dir :: Name -> [[Path]] -> [Path]
|
||||||
dir n subs = map (\path -> [n] ++ path) (concat subs)
|
dir n subs = map (n :) (concat subs)
|
||||||
|
|
||||||
-- >>> findAll "notes.txt" example
|
-- >>> findAll "notes.txt" example
|
||||||
-- [["root","desktop","notes.txt"],["root","pictures","holiday2018","notes.txt"]]
|
-- [["root","desktop","notes.txt"],["root","pictures","holiday2018","notes.txt"]]
|
||||||
|
|
Loading…
Reference in a new issue