1
0
Fork 0

Implemented the list-operations exercise

main
Oliver Stolle 2026-06-01 20:05:12 +00:00
parent 522fd6df17
commit d08714a7a9
1 changed files with 8 additions and 1 deletions

View File

@ -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)