Answered step by step
Verified Expert Solution
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
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 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
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