mirror of
https://github.com/iritmaximus/haskell.git
synced 2026-10-12 19:13:39 +03:00
ex13. hetkeen en ole ollut näin onnellinen <3
This commit is contained in:
+6
-1
@@ -278,7 +278,12 @@ multiCompose fs x = foldr (\f x -> f x) x fs
|
||||
-- multiApp id [head, (!!2), last] "axbxc" ==> ['a','b','c'] i.e. "abc"
|
||||
-- multiApp sum [head, (!!2), last] [1,9,2,9,3] ==> 6
|
||||
|
||||
multiApp = todo
|
||||
multiApp :: ([b] -> c) -> [a -> b] -> a -> c
|
||||
multiApp f gs x = f (multiApp' gs x [])
|
||||
where
|
||||
multiApp' :: [a -> b] -> a -> [b] -> [b]
|
||||
multiApp' [] x acc = acc
|
||||
multiApp' (g:gs) x acc = g x : multiApp' gs x acc
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- Ex 14: in this exercise you get to implement an interpreter for a
|
||||
|
||||
Reference in New Issue
Block a user