乐趣区

关于后端:IN3043-Functional

IN3043 Functional Programming
Coursework
There is a single coursework in this module, counting for 30% of the overall module mark.
This coursework is due at 5pm on Sunday 5th December. As with all modules, this deadline is
hard. (See“Submission”below for the extension procedure.)
This coursework provides practice with Haskell and the use of containers. This task does not
require any material presented after session 6, and I do not expect to see it in your solutions.
The task
You are to write a number of functions that perform queries on a list of customer ratings of
products, represented by the type Rating defined as
type Customer = String
type Product = String
type Score = Int
type Rating = (Customer, Product, Score)
The functions to be defined are:
customers :: [Rating] -> [Customer]
a list of all customers who submitted a rating, without duplicates. (10%)
products :: [Rating] -> [Product]
a list of all products that have been rated, without duplicates. (10%)
numScores :: [Rating] -> [(Customer, Int)]
customers and the number of products they have rated. (20%)
consistent :: [Rating] -> [Customer]
a list of the customers who give the same score in all their ratings. (20%)
averageScore :: [Rating] -> [(Product, Double)]
the average score of each product. (20%)
popular :: [Rating] -> [Product]
the products that have each been rated by every customer. (20%)
I have supplied a skeletal module Ratings.hs. You must not change the declarations in
that file (I will rely on them for automatic testing) but you can add whatever else you like.
The proportional value of each function is given above. Your implementations will be as-
sessed for correctness, clarity and effective use of Haskell, the container libraries and other ap-
propriate library functions.
1
Submission
You should submit your version of the file Ratings.hs via Moodle by the due date.
If you believe that you have extenuating circumstances that justify an extension, you should
submit your work to smcse-extension@city.ac.uk within one week of the dead-
line (i.e. by 5pm Sunday 12th December), including your student number, course, module
code and the original due date, and
apply for an extension through the Extenuating Circumstances process.
As not all claims for extenuating circumstances meet the criteria, you can also submit on Moodle
what you have by the deadline, as a fallback in case your claim is rejected.
Help and feedback
Please ask general questions about the coursework on the Moodle discussion board. Queries by
email will be answered on that board, so that everyone gets the same information.
We can view and discuss draft solutions in the weekly lab session. You can also use my
drop-in hours or make an appointment by email to see me at other times.
Sample solutions will be published on Moodle after the deadline. Marks and comments on
your code will be returned via Moodle.

退出移动版