From ef1ff6c27a6a592bed883425e5daafe39864846a Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 16 Jun 2024 14:22:08 +0200 Subject: [PATCH] Improve filesystem solution --- Exercises/exercise-3/Filesystem.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exercises/exercise-3/Filesystem.hs b/Exercises/exercise-3/Filesystem.hs index 1e942b0..d304dc2 100644 --- a/Exercises/exercise-3/Filesystem.hs +++ b/Exercises/exercise-3/Filesystem.hs @@ -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"]]