# BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

# Haskell代写｜COMP 3007 − “Programming Paradigms” Assignment 4

### Haskell代写｜COMP 3007 − “Programming Paradigms” Assignment 4

The objective of this assignment is to allow you to practice with recursive design and the recursive definition
of lists in Haskell by designing and implementing functions for determining the divisors for an integer and
whether or not that integer is a prime number.

If you do not recall the definition of a prime number, you are directed to first take a few minutes and read
the article at https://mathworld.wolfram.com/PrimeNumber.html.
For an additional example of process for determining whether or not a positive integer is prime, consider the
following:

A list of the divisors of the positive integer 12, for instance, are [12, 6, 4, 3, 2, 1].

As this list contains elements other than 12 and 1, the positive integer 12 is NOT prime.

A list of the divisors of the positive integer 13, for instance, are [13, 1].

As this list contains only elements 13 and 1, the positive integer 13 IS prime.

For this assignment:

• you must write a recursive function that provides (as a return value) a list of every divisor of the
positive integer specified. This function will not be called directly, but will instead be called by a non
recursive function you will also create, using type declaration Integer -> [Integer]. To clarify, the non
recursive function will be called with the integer argument, and this function will call the recursive
function and then return the resulting list of Integer divisors.

• you may use the built-in “mod” function for modulation.

• your program will be penalized if this list of divisors is not constructed in descending order (i.e., from
largest to smallest), but you are not permitted to apply any sort algorithm to the result.

• you must write another function using type declaration Integer -> Boolean that uses your other
functions to determine whether or not the Integer argument is a prime number.

• your function for determining whether or not a number is prime must use the “trace” and “show”
functions to justify your answer (by printing the list of divisors). You have used the “trace” function
for the previous assignment, and the “show” function takes an argument of any type and produces a
string representation of it as a return value.

• you may assume that the integer arguments you receive during testing will always be positive. 