Haskell Question

0 comments

There are 3 haskell coding questions.

The detailed requirement is in the file I uploaded.

Question 1 In this question, you are asked to implement two functions that sum the elements in a

list of integers. Their type signatures are:

sum1 :: [Int] -> Int

sum2 :: [Int] -> Int

>>> :l question1.hs

(a) Implement the sum1 function without help from any standard library functions other than the

standard addition operator. To do this, you need to think recursively: What is the sum of the empty

list of elements? Given a list x:xs with a head x and a tail xs , how can you recursively define the

sum of the elements in this list? This should lead to two equations of the form:

In this question you are asked to implement a function basicStats which takes a list of Double s as

argument and returns a pair of Double s, the first one the mean of the elements in the list, the second

their standard deviation:

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}