Labs are where you will work on practical programming skills, under the guidance of experienced tutors.
Read the tasks for the week before you attend the labs, and make a plan on how to approach and solve the tasks ahead of time. The tutors will be are there to help and give you feedback for your ideas (not to do the job for you).
The lab documents are finalised by Monday morning, before the first lab of the week—otherwise they are just a sneak preview (and can still change).
Material in these labs has been developed over several years, by Uwe Zimmer,
James Barker, Clem Baker-Finch, Tony Hosking, Ekaterina Lebedeva, Ranald Clouston,
and a whole host of dedicated tutors.
Copyright © The Australian National University, All Rights Reserved.
Welcome to Week 1 lab for Programming as Problem Solving! The aim of this lab is to help you get started in the lab computing environment and introduce tools you will use throughout the course. If you have questions you can ask your tutor for help. If your tutor is busy with another student feel free to work with one of your lab mates to figure things out.
In this lab we will look at algebraic data types, pattern matching with the
case command, and guarded expressions.
In this lab, we will meet the Cabal package manager, which helps us work on
projects with dependencies between multiple files. We will then program with the
codeworld-api library, which provides us with types and functions for drawing and
transforming various shapes.
In this lab we learn about the concept of recursion, which gives us the ability to “loop”, or repeat the same instruction many times over. We also investigate our first recursive data type, lists, that can pack many instances of a type together. We will write recursive functions over integers and lists.
This lab covers more recursive functions over lists, the concept of parametric polymorphism, and how it can be used to write functions that operate on more general types than before. We will see some examples of custom recursive data types, and how to write recursive functions over them.
In this lab, we cover type classes and ad hoc polymorphism, and how we can use these concepts to generalise functions that require some assumptions about the input type. We also continue the topic of trees from last lab, and introduce binary search trees, which are trees with a special ordering constraint that gives them a great advantage over binary trees in terms of computational efficiency.