Due Thursday, August 25 at 11:59 PM
By the time you have completed this work, you should be able to:
enum
in Swift)switch
in Swift)For this assignment, you'll be using Swift. You can either install Swift from this link, or run it in the browser here. Binaries are available for Ubuntu Linux and Mac OS X. Exactly which method you use doesn't matter; it will work the same either way.
A significant of code has been provided in main.swift
, including a test suite of significant size.
As with assignment 1, you are tasked with writing a singly-linked list.
However, this time around, you'll be doing this in Swift.
Instead of using dynamic dispatch to select between cons
and nil
behavior, you'll be using pattern matching via switch
.
Additionally, you'll also be defining key list-based operations which work with higher-order functions, namely filter
and map
.
The comments in the file provide further details.
Note that the tests themselves are a rich source of information, both in terms of defining what you need to implement (i.e., they serve as a specification), and how Swift works.
Log into Canvas, and go to the COMP 333 class. Click “Assignments” on the left pane, then click “Assignment 3”. From here, you need to upload the following files:
main.swift
In addition, if you collaborated with anyone else, be sure to download collaborators.txt
and write the names of the people you collaborated with in the file, one per line.
Please submit this file along with the other files.
You can turn in the assignment multiple times, but only the last version you submitted will be graded.