Question: Homework #2 1. Write a function intlog of type Integer Integer that returns the exponent of the largest power of 2 less than its integer

 Homework #2 1. Write a function intlog of type Integer Integer

Homework #2 1. Write a function intlog of type Integer Integer that returns the exponent of the largest power of 2 less than its integer argument. Your function need not behave well if the parameter is negative. Try your function on intLog 568. Turn in a listing of the function and the results of the test run. 2. Write a function removeFirst of type (Char, [Char]) [Char] that takes a character c and a string s as arguments, and returns the resulting substring of s after moving the first occurrence of c. For example removefirst ('b, "fw3b2rbm2") evaluates to "ax54/mz. Turn in a listing of the re function, and the results of this test case. 3. Write a function firsts of type [ (a , b))4-a)] that takes a list of pairs, and returns a list of the first objects in the pairs. For example, the expression firsts [(False,u'),(True, 'v'), (True, 'w')1 would evaluate to True, False, True]. Turn in a listing of your function, and the results of this test 4. For each of the following haskell type declarations, declare an object of the type this. type this = (B001], Float) luple type this = (Float. Integer)-> ([Float], Integer) Ancin data that = in Char l out Integer type this = [(Float, that)) type d. this = (a, b)-> (a, a) Note: Definitions in a file can be loaded into the Hugs interpreter with the command: :load filename

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!