Skip to content

Instantly share code, notes, and snippets.

@lmazardo
Created February 22, 2013 20:46
Show Gist options
  • Save lmazardo/5016424 to your computer and use it in GitHub Desktop.
Save lmazardo/5016424 to your computer and use it in GitHub Desktop.
grading in coursera programming languages
datatype note = ProgrammingAssignments of int list
| PeerAssignments of int list
| Exam of int list
| Note of note list
fun grading n =
case n of
ProgrammingAssignments pl => (case pl of
[] => 0.0
| x::xs => 0.9 * Real.fromInt(x) + grading (ProgrammingAssignments xs))
| PeerAssignments pa => (case pa of
[] => 0.0
| x::xs => 0.1 * Real.fromInt(x) + grading (PeerAssignments xs))
| Exam e => (case e of
[] => 0.0
| x::xs => 0.15 * Real.fromInt(x) + grading (Exam xs))
| Note n => (case n of
[] => 0.0
| x::xs => grading x + grading (Note xs));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment