Question: [3 points] Let foo and bar be Haskell functions. foo i [] = False foo i (x:xs) |i == x = True | otherwise
![[3 points] Let foo and bar be Haskell functions. foo i []](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2020/06/5ed79ffe1d33e_1591189501155.jpg)
[3 points] Let foo and bar be Haskell functions. foo i [] = False foo i (x:xs) |i == x = True | otherwise = foo i xs bar [] = [] bar (x:xs) y | (foo x y) == False = [x] ++ bar xs y | otherwise = bar xs y In the above code segment, the bar function takes two lists as input and returns a list composed of elements belonging to the first input list but not the second input list. the bar function takes two lists as input and returns a list composed of elements which belong to both lists. the bar function takes two lists as input and returns a list that is the concatenation of the two input lists. the function foo reverses an input list. the function foo takes an element and a list as input and returns whether the element is the first item in the list.
Step by Step Solution
3.34 Rating (154 Votes )
There are 3 Steps involved in it
To understand the behavior of the foo and bar functions lets break down what they do Function foo ha... View full answer
Get step-by-step solutions from verified subject matter experts
