Question: HASKELL you are going to write a pure functional program using the Haskell language. Define a function named primes with the following signature: primes ::
HASKELL
you are going to write a pure functional program using the Haskell language.
Define a function named “primes” with the following signature:
primes :: Integer -> Integer -> [Integer]
That is, primes is a function that takes two Integers as parameters and returns a list of Integers. For any
positive value a and b, primes a b should return a list of all prime numbers1 that are between a and b
(inclusive). You can assume the parameters are always positive. But you cannot assume that a ≤ b (that is,
they may be out of order). For example:
primes 5 10 → [5, 7]
primes 10 20 → [11, 13, 17, 19]
primes 5 41 → [5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41]
primes 20 22 → []
primes 30 20 → [23, 29]
You are not allowed to use any import statement in your code.
You can only define one single function on the top level. If you define other functions and/or symbols on the
top level, 20% of your raw score will be deducted.
Step by Step Solution
3.54 Rating (151 Votes )
There are 3 Steps involved in it
Functional Haskell program step by step explanation primes Integer Integer Integer This line defines the primes function that takes two integers as in... View full answer
Get step-by-step solutions from verified subject matter experts
