Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer question (3) a. In Haskell with Code with main to test the function weighs 1370 01 place. Ihe assignment COLISIsung 01 all ou

image text in transcribedPlease answer question (3) a. "In Haskell" with Code with main to test the function

weighs 1370 01 place. Ihe assignment COLISIsung 01 all ou for the class. (1) Define the following in Haskell: (a) A function checksum::Int -> Int -> Int -> Bool that evaluates to True on input a, b and c if and only if a +b = c. (b) A function higherchecksum: : (Int -> Int) -> Int -> Int -> Int -> Bool that evaluates to True on input f, a, b and c if and only if f(a) + f(b) = f(c). For (b) check that the provided tests evaluate to True. (2) Define a function notdivisible:: Int -> Int -> Bool that evaluates to True on input a and b if and only if a is not divisible by b (in particular, if b == 0). Test this function by entering the following expression into ghci: filter (\x -> notdivisible x 2) [0..100] Play with the expression in order to understand what is happening. (3) The following Haskell expression defines the list of integers from 0 to 1000: list = [x | x Int that computes for any positive integer n the squared factorial (n!)2 == (1 * ...* n)? (b) What happens if you run the program on input 50? Explain! (answer to part (b) does not need to be submitted)

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

Step: 3

blur-text-image

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

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

Types of cultural maps ?

Answered: 1 week ago

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

Define the term "Leasing"

Answered: 1 week ago

Question

What do you mean by Dividend ?

Answered: 1 week ago

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago