Question: please in Haskell no high order function Generate a 2d matrix (list of tuples of Int and Float, two rows, each tuple being a column)

please in Haskell no high order function

Generate a 2d matrix (list of tuples of Int and Float, two rows, each tuple being a column) of numbers that go from 0 to 50 in the first row, and .50 to 1.0 in the second, using list comprehension. i.e. [(0, .50), (1, .51), . . .]

2. Write a function named generation using guards that takes in an age (could be an Int, could be an Integer, etc, but doesn't take floating points: use type classes) and returns which generation they belong to. Use where to convert age to birth year and use it. The generations are as follows:

If the person was born after 1995, they are "Generation Z". Else if the person was born after 1980, they are "Millennial". Else if they were born after 1965 they are "Generation X". Else if they were born after 1945 they are "Baby Boomer". Else if they were born after 1933 they are "The Silent Generation". Otherwise they are "The Greatest Generation".

3. Complete a function that takes a Float and a list of Floats. Use list comprehension to multiply each value in the list by pi * a, where a is the Float passed in. Use let to get pi*a.

4. Implement a search algorithm that searches through a list for Int n and returns the value in the list 2 places before n. If there is no such value (either because n isn't in the list, or there is no number two places before it), return -1. E.g., findPrev 5 [1,2,3,4,5,6] should return 3, while findPrev 5 [0, 5, 20, 30] returns -1.

5. Implement a sorting algorithm that takes a list of Int, finds the min, puts it at the beginning of the list, then recursively sorts the remainder of the list. You can create/use any helper functions you need, provide that you wrote it yourself, or it's built into Haskell.

in Haskell please

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!