Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

What are the best practices for managing a large software project?

Answered: 1 week ago

Question

How does clustering in unsupervised learning help in data analysis?

Answered: 1 week ago