forked from steger/pr3-sose2026
Implemented the list-operations exercise
parent
522fd6df17
commit
d08714a7a9
|
|
@ -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"
|
-- 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)
|
test1 = Test.HUnit.TestCase (assertEqual "ExtractedNames" ["EMMA", "ISABELLA"] extractedNames)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue