diff --git a/haskell/02-list-operations/list-operations.hs b/haskell/02-list-operations/list-operations.hs index 96aef07..35eecc3 100644 --- a/haskell/02-list-operations/list-operations.hs +++ b/haskell/02-list-operations/list-operations.hs @@ -13,7 +13,14 @@ ages = [25, 30, 22, 29, 35, 28, 40, 26, 33, 31] -- we are looking for the UPPERCASE names of the two oldest persons whose names ends with an a sorted alphabetically" -extractedNames = [] +extractedNames = + map (map toUpper) + . sort + . map fst + . take 2 + . sortOn (negate . snd) + . filter (\(name, _) -> last name == 'a') + $ zip names ages test1 = Test.HUnit.TestCase (assertEqual "ExtractedNames" ["EMMA", "ISABELLA"] extractedNames)