Starting from:

$29.99

WEEK 4 ASSIGNMENT Built-in list iterators

CMPS 258 – PROGRAMMING LANGUAGES
WEEK 4 ASSIGNMENT
In this assignment, you will use the built-in list iterators with anonymous functions to re-implement some
of the functions you implemented in the first assignment. You should only use the following built-in list
iterators: List.map, List.filter, and List.foldl. You are not allowed to use case expressions
or the list access functions to access the lists.
(1) Re-implement score from the first assignment. Do not use the tuple access operator to extract
the fields of the tuple. Instead, extract the fields using pattern matching in the function
parameter.
(2) Use one of the built-in list iterators to re-implement scores from the first assignment.
(3) Use one of the built-in list iterators to re-implement whoFailedMidterm from the first
assignment.
(4) Use one of the built-in list iterators to re-implement allPassedFinal from the first
assignment.
(5) Use one of the built-in list iterators to re-implement countPassedCourse from the first
assignment.
(6) Use one of the built-in list iterators to re-implement studentsInRange from the first
assignment.
Evaluating a correct homework solution should generate the bindings below. However, keep in mind that
generating these bindings does not guarantee that your solutions are correct. Make sure to test your
functions before submitting.
val score = fn : 'a * 'b * real * real -> real
val scores = fn : ('a * 'b * real * real) list -> ('a * real) list
val whoFailedMidterm = fn
 : ('a * 'b * real * 'c) list -> 'b list
val allPassedFinal = fn : ('a * 'b * 'c * real) list -> bool
val countPassedCourse = fn : ('a * 'b * real * real) list -> int
val studentsInRange = fn
 : ('a * 'b * real * real) list
 -> real * real -> ('a * 'b * real * real) list
Assessment
Solutions should be:
 Correct
 In good style, including indentation and line breaks
 Written using features discussed in class
Submission Instructions
Put all your solutions in one SML file and submit it via Moodle. The file should be named “<id>.sml” where
<id> is your AUBnet ID (e.g., abc01.sml). Do not submit any other files or compressed folders.

More products