Question
Haskell Language -- higher-order functions with some basic datatypes ---------------------------------------------------------------------- -- p1 f x should call f three times (in nested fashion) on x p1
Haskell Language
-- higher-order functions with some basic datatypes
----------------------------------------------------------------------
-- p1 f x should call f three times (in nested fashion) on x
p1 :: (a -> a) -> a -> a
p1 = undefined
-- p2 f x should call f with x and x as the two inputs to f
p2 :: (a -> a -> c) -> a -> c
p2 = undefined
--apply a function to each component of a tuple, building a new tuple
p3 :: (a -> b) -> (a,a) -> (b,b)
p3 = undefined
{- for p3 and p4, there is only one way to return a value of the
desired output type. (So the type completely specifies what
the code must do.) -}
p4 :: (a -> b -> c) -> (a -> b) -> a -> c
p4 = undefined
p5 :: (b,d) -> (b -> c) -> ((c,d) -> e) -> e
p5 = undefined
{- change the order of the types in the input tuple of a function. -}
p6 :: ((a,b) -> c) -> (b,a) -> c
p6 = undefined
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started