mirror of
https://github.com/iritmaximus/haskell.git
synced 2026-10-12 19:13:39 +03:00
ex12. multicompose done with foldr :)
This commit is contained in:
+2
-1
@@ -256,7 +256,8 @@ sumRights = foldr (\a b -> fromRight 0 a + b) 0
|
|||||||
-- multiCompose [(3*), (2^), (+1)] 0 ==> 6
|
-- multiCompose [(3*), (2^), (+1)] 0 ==> 6
|
||||||
-- multiCompose [(+1), (2^), (3*)] 0 ==> 2
|
-- 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
|
-- Ex 13: let's consider another way to compose multiple functions. Given
|
||||||
|
|||||||
Reference in New Issue
Block a user