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

Consider the following function: myLister:: [[x]] rightarrow [x] myLister Is = |

ID: 3798443 • Letter: C

Question

Consider the following function: myLister:: [[x]] rightarrow [x] myLister Is = |x | xs leftarrow Is, (length xs 'mod' 2 == 0), x leftarrow xs] What does it return on the following input: Main > myLister ("This", "is", "a", "longish", "sentence"] What does the following function do? functionr:: (Enum t, Num t) => t rightarrow [a] rightarrow ([a]] functionr x Is = [1s++1s | _ leftarrow [l..x]) Describe what it does and give two examples of its output for different inputs. There are errors in this pair of functions for determining whether a non-negative natural number is even or odd. Find the bugs and fix them. isOdd 1 = True isOdd n = isEven n-1 isEven 0 = True isEven m = isOdd m-1

Explanation / Answer

Ans.1.

myLister function removes the outer list and combines the elements of th inner list. Therefore, the return value would be:
This is a longish sentence.

Ans.2.

functionr puts the elements in a list.

Eg: functionr("This is a longish sentence") -> ["This", "is", "a", "longish", "distance"]
functionr(4,5,3,2) -> [4, 5, 3, 2]

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