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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!