HASKELL you are going to write a pure functional program using the Haskell language. Define a function
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 :: 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.
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp