Ready to begin
No records have been processed. Start with Next step.
![The returned outer order is [A-list,B-list,C-list,D-list]. Each extracted component remains a list of IDs.](/images/computational-thinking/week-6/unpack-grades.png)
Follow the selected procedure. Change a field, tie rule or weekday and explain why the result changes.
Ready
No records have been processed. Start with Next step.
Predict the next change. Keep track of which list level, field and position convention the procedure uses.
G = SimpleGradeAssignment(SortedMarks)
A = first(G)
B = first(rest(G))
C = last(init(G))
D = last(G)The grading procedure returns one outer list containing four lists. Its outer length is 4 even though there are 30 IDs across the inner lists. Each inner list can have a different length or be empty. Evaluate nested expressions from the inside out.
first(G) is the complete A-grade list. first(first(G)) would be its first student ID, and is safe only if A is non-empty. last(init(G)) selects the third grade list; it does not automatically select its final student.
What is the type of first(G)?
A list of student IDs.
What is length(G) for this contract?
4, because the outer result has A, B, C and D components.
Is first(first(G)) always defined?
No. The A list might be empty even when G itself contains four lists.