ex12. multicompose done with foldr :)

This commit is contained in:
Aaro Koivukangas
2024-01-17 13:13:29 +02:00
parent 387e8c3d2b
commit 9dfb904415
+2 -1
View File
@@ -256,7 +256,8 @@ sumRights = foldr (\a b -> fromRight 0 a + b) 0
-- multiCompose [(3*), (2^), (+1)] 0 ==> 6
-- multiCompose [(+1), (2^), (3*)] 0 ==> 2
multiCompose fs = todo
multiCompose :: [a -> a] -> a -> a
multiCompose fs x = foldr (\f x -> f x) x fs
------------------------------------------------------------------------------
-- Ex 13: let's consider another way to compose multiple functions. Given