Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedPlease answer question (2) "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

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

Students also viewed these Databases questions