Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer question (1) b. In Haskell weighs 1370 01 place. Ihe assignment COLISIsung 01 all ou for the class. (1) Define the following in

image text in transcribedPlease answer question (1) b. "In Haskell"

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

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

How to find if any no. is divisble by 4 or not ?

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago