Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please, answer question (4) in Haskell with main to test the function. Thanks cycleinc::[Integer] -> [Integer] cycleinc = undefined (1) Define a function myrepeat:: Char
Please, answer question (4) in Haskell with main to test the function. Thanks
cycleinc::[Integer] -> [Integer] cycleinc = 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 compLettersStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started