CSCI 360 - Survey of Programming Languages
Fall 2014
Assignment 9: Higher-order functions and lazy evaluation
We have been reading the paper
Why Functional Programming Matters.
A central assertion of the paper is that, for improved modularity, algorithms
should be modularized using higher-order functions and lazy evaluation.
Your assignment is:
- Identify two algorithms you have implemented at some point in the past, in any language.
- Reimplement each algorithm in Haskell, modularizing it using higher-order
functions and lazy evaluation.
- Try to follow the style of the examples in the paper.
- Implement any supplementary data types you will need.
- If the algorithm made significant use of I/O, feel free to simulate input by writing a function to generate a list of inputs, and output by generating a list of outputs.
- For each algorithm, implement at least one variation for a related task that takes advantage of the modularized components you created to maximize code reuse.
- Write at least one QuickCheck property for each of the four algorithms
you have implemented, to document in some way its purpose.
- On Wednesday, 10/22, each student should have a PowerPoint
presentation with two slides, one for each of the algorithms you have chosen. On each slide:
- Describe the context for the algorithm you selected.
- Briefly outline your strategy for rewriting it in Haskell.
- On Wednesday, 10/29, submit your implementations via Moodle.