Question: Please, Answer question (3) in Haskell with main to test the function. Thanks circlesurface :: Float -> Float circlesurface = undefined (1) Define a function
Please, Answer question (3) in Haskell with main to test the function. Thanks
circlesurface :: Float -> Float circlesurface = undefined

(1) Define a function myrepeat:: Char -> [Char] that takes a character c and generates an infinite list consisting of c's only. Do not use Haskell's repeat function! (2) Define the following functions in Haskell without using the predefined Haskell func- tions isDigit and to Lower: (a) The function myisDigit that checks if a character is a digit. (b) The function mytolower that lowers only upper case letters (all other characters should remain unchanged). Hint: Use chr,ord and the definitions of offset and capitalize from class. (3) Define a function circlesurface::Float -> Float that gets as input the radius of a circle and returns its surface. (4) Define a function cycleinc:: [Integer] -> [Integer] that creates an infinite list by repeating a given finite list indefinitely, adding in each repetition 1 to each element of the original list. Example: cycleinc [1,2,3] = [1,2,3,2,3,4,3,4,5..] (5) We want to compute the function compLetters that has two letters as input and outputs the character that appears earlier within the alphabet. The function should ignore whether or not a letter is in lower or upper case. Write a Haskell program that computes the function compLetters. (1) Define a function myrepeat:: Char -> [Char] that takes a character c and generates an infinite list consisting of c's only. Do not use Haskell's repeat function! (2) Define the following functions in Haskell without using the predefined Haskell func- tions isDigit and to Lower: (a) The function myisDigit that checks if a character is a digit. (b) The function mytolower that lowers only upper case letters (all other characters should remain unchanged). Hint: Use chr,ord and the definitions of offset and capitalize from class. (3) Define a function circlesurface::Float -> Float that gets as input the radius of a circle and returns its surface. (4) Define a function cycleinc:: [Integer] -> [Integer] that creates an infinite list by repeating a given finite list indefinitely, adding in each repetition 1 to each element of the original list. Example: cycleinc [1,2,3] = [1,2,3,2,3,4,3,4,5..] (5) We want to compute the function compLetters that has two letters as input and outputs the character that appears earlier within the alphabet. The function should ignore whether or not a letter is in lower or upper case. Write a Haskell program that computes the function compLetters
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
