Question: Assume the following function definitions exist: nmap f [] = [] nmap f (x:xs) = (f x): (nmap f xs) nfilter f [] =

Assume the following function definitions exist: nmap f [] = [] nmap f (x:xs) = (f x): (nmap f xs) nfilter f

Assume the following function definitions exist: nmap f [] = [] nmap f (x:xs) = (f x): (nmap f xs) nfilter f [] = [] nfilter f (x:xs) = if (f x) then (x: (nfilter f xs)) else (nfilter f xs) reduce fs [] = s reduce fs (x:xs) = f x (reduce f s xs) for m n f s = if (m>n) then s comp f g x y = fx (g x y) iter 0 f s =S iter n fs = iter (n-1) f (fs) zpt a [] = [a] zpt a (x:xs) = if a>x then a: (x:xs) else x: (zpt a xs) What are the values of the following expressions?: nmap even [1,2,3,4,5,6] else for (m+1) n f (f ms) nmap ((+) 2) (nfilter even [1,2,3,4,5,6]) iter 10 ((*) 2) 4 reduce zpt [] [1,3,4,2,3,1] for 10 13 zpt [] reduce (comp (*) (+)) 1 [1,2,3] Note: (*) x y = x*y; (+) x y = x+y; even x (x 'mod' 2 == 0)

Step by Step Solution

3.33 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Youve shared an image with functional programming definitions and expressions to be evaluated Lets go through each expression one by one 1 nmap even 1... View full answer

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 Programming Questions!