Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a gofer function map2 that takes a list of functions and listof values ret

ID: 3611464 • Letter: W

Question

Write a gofer function map2 that takes a list of functions and listof values returns the list of results from applying each functionin the first list to the corresponding value in the secondlist.

For example, map2[((*)2), ((+1)2)] [4,3] yields [8,5].

Explanation / Answer

/* map2[((*)2), ((+1)2)] [4,3] yields [8,5]. Is the "1" i highlighted a typo test with map2[((*)2), ((+)2)] [4,3] yields [8,5]. it worksfine */ listReverse :: [Int] -> [Int] -> [Int] listReverse [] temp = temp listReverse (head : tail) temp = listReverse tail (head: temp) map2helper :: [ Int->Int] -> [Int] -> [Int]-> [Int] map2helper [] [] temp = temp map2helper (head : tail) (p : q) temp = map2helper tail q ( (headp) : temp) map2 :: [ Int->Int] -> [Int] -> [Int] map2 l m = (listReverse (map2helper l m []) [] )

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote