What Needs To Be Done
Prelude
You are at your desk. Your computer screen blares bright, vibrant in the night. It’s a Thursday- but Mooseheads won’t be seeing your moves tonight- your assignment is due ont the morrow. Your desk- a perfect metaphor for your life- is a mess. You dig between papers of wild scribbles of code, PAL sheets and poems declaring your love for Haskell, trying to find your mouse, only to pick up a potato. You gaze at it, wondering how different the two of you really are.
“There you are!” a joyful voice calls. You gasp, and turn to see the silhouette of Tony in your doorway. He’s holding large, black bags. Garbage bags.
“Don’t look so scared! I’m here to help you sort out this mess of yours. Once we’ve got this rubbish all sorted and properly disposed of, you’ll find that you’re coping with life just fine!”
A garbage truck outside rattles agreeably, and you turn back to the desk. You’re ready- so ready- to carefully formulate a plan and sort out your ideas- and smash that Haskell like none before!
Exercise 1: Eval
Brainstorm how a program that evaluates basic mathematical operations (addition, subtraction, multiplication and division) when given an expression in words. Try to build a datatype (perhaps called Operations) to express all that maths. You may assume that your input numbers are doubles, or something more general ;)
Exercise 2: Chess
You know what is awesome? Chess is awesome. What else is awesome? Haskell is awesome. So why don’t you combine both- write datatypes and functions you would need to run a game of chess.
Exercise 3: Your Assignment
Create a mind map of your assignment.
Feel free to be liberal with the idea of a “mind map”- what’s important here is that you write down every major function you will need to make, its type signature, and how it relates to other functions (i.e. what other functions need to use it? How does it use other functions?).
Make sure you get everyone involved- you’ll be less likely to forget parts if you are working with others!