type string == list(char); type student == string X string; type class == list(student X num); c:class; c <= [(("Fred","Jones"),66),(("Ali","Mohamed"),76),(("Mary","Ward"),92),(("Colin","Gold"),31)]; c; type course == string X class; c1: course; c1 <=("CS1", c); c2: course; c2 <=("Maths", [(("Fred","Jones"),36),(("Ali","Mohamed"),56),(("Mary","Ward"),45),(("Colin","Gold"),71)]); type degreeprogramme == list(course); cs:degreeprogramme; cs <= [c1,c2]; cs;

- Write a function which returns the number of courses on a degree programme.
- Write a function
`allStudentsInClass:class -> list(student)`

which returns all students in a class. - Write a function
`allStudentsOnCourse:course -> list(student)`

which returns all students on a course. - Write a function
`allStudentsOnDegreeProgramme:degreeprogramme -> list(student)`

which returns all students on a degree programme. The easiest way to do it is to append the list of students on each course together and then remove duplicates. - Write a function
`bestStudentInClass:class -> student`

which returns the best student in a class. For example`bestStudentInClass(c)`

should return`("Ali","Mohamed")`

. - Write a function
`bestStudentInCourse:course -> student`

which returns the best student on a course. For example`bestStudentInCourse(c1)`

should return`("Ali","Mohamed")`

. - Write a function
`bestStudents:degreeprogramme -> list(string X student)`

which returns a list of the best students on each course in a a degree programme. For example`bestStudents(cs)`

should return`[("CS1",("Ali","Mohamed")),("Maths",("Colin","Gold"))]`

. - Write a function
`average1:degreeprogramme -> list(string X num)`

which returns a list of the average marks for each course. For example`average1(cs)`

should return`[("CS1",65.25),("Maths",52)]`

. - Write a function
`average1:degreeprogramme -> list(student X num)`

that list all students together with there average mark on a degree programme. This function should be sorted in descending order of average mark. - Write a function which works out the number of students on each degree classification.

s.danicic@gold.ac.uk

Sebastian Danicic BSc MSc PhD (Reader in Computer Science)

Dept of Computing, Goldsmiths, University of London, London SE14 6NW

Last updated 2011-03-15