user424683
user424683

Reputation: 1

classList in Haskell Help

Can anyone help with my last assignment question that i got stuck on for 2 days straight. I'm suck at Haskell and this question seems to be too advanced for me, so please help me cos its due mid-night tonight.

Any help is really appreciated.

Here is my question.

Your main task in this question is to define the function classlist :: (Codes, Marks) -> Ranks that takes the list of names and id numbers, and the list of id numbers and marks, and returns the list of names, marks, and final rankings.

Thanks in advance!!!

Upvotes: 0

Views: 163

Answers (1)

Nathan Shively-Sanders
Nathan Shively-Sanders

Reputation: 18399

Your question has two parts: (1) get name and mark matched together, then (2) rank the names by their marks.

For the first part of your question, you should think something like this:

Codes maps a Name to an Iden. Marks maps a Iden to a Mark. Somehow you have to map a Name to a Mark.

To do that, for each Name in Code, take the associated Iden and look it up in Marks. That should give you the associated Mark, which you can then match with theName`.

For the second part, you have to sort the newly associated (Name, Mark) pairs, probably by Mark. Then you should be able to take that list and add a Rank to each one, starting from 1 and counting up.

By the way, midnight is still 4 hours off for me, but I bet that it is considerably closer for you (unless you are in Australia)...so this advice may not come in time. You might start asking your instructor or classmates for help earlier next time.

Upvotes: 1

Related Questions