Improve filesystem solution

This commit is contained in:
Manuel Thalmann 2024-06-16 14:22:08 +02:00
parent 67fbeab9a6
commit ef1ff6c27a

View file

@ -95,7 +95,7 @@ findAll name = filesystem file dir
file :: Name -> Int -> [Path]
file n _ = if n == name then [[n]] else []
dir :: Name -> [[Path]] -> [Path]
dir n subs = map (\path -> [n] ++ path) (concat subs)
dir n subs = map (n :) (concat subs)
-- >>> findAll "notes.txt" example
-- [["root","desktop","notes.txt"],["root","pictures","holiday2018","notes.txt"]]