Functional Programming Project


I am TAing an undergraduate course on Programming Languages and the instructor has asked me to conduct my discussion on functional programming. The students would also be required to implement a project using a functional language (Erlang). I am looking for ideas about what the project should be. The timeline for the project is 5 weeks.

I have come up wih the following two and welcome any critical remarks about these ideas:

1. Mapreduce - Implementation of mapreduce and then an application based on mapreduce. I thought it would be interesting to ask the students to do a sequential implementation and then parallelize and then compare the results.
2. Purely functional data structure - This is based on the thesis of Chris Okasaki . I am considering asking students to implement a variation of queue data structure such as "Hood - Melville real time queues".

I would be really glad if I could get some ideas/comments.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


Sounds like an interesting idea. The biggest problem with TAs, by and large, is that they tend to have less than realistic expectations.

With regard to MapReduce, the project might be a very good idea; but I would want to know that you have actually done this project yourself ahead of time, and that you understand many of the potential pitfalls. I wouldn't launch into the great unknown in an undergraduate course, because your intuition says something should be easy enough.

With regard to queues, couldn't you abuse Erlang's message queues to implement a real-time-ish queue? This might turn out to be a very bad idea, at least in the context of OTP, the only non-toy implementation of Erlang available, and it certainly does not fall under the category of a "purely functional" implementation.

Basically, a queue would be a thread that accepts {enq, Value} messages and responds to a deq message with the Value that is the head of the queue.

Aside from the fact that I don't know enough about the nitty-gritty implementation details of OTP's message queues, the biggest potential problem I see with this idea is the scheduling overhead incurred. I would definitely want control to pass directly from the client thread to the queue thread and back, with the scheduler seeing it as a single thread of control.


i'd suggest that an ideal project format is an incremental one: if people get through the easy part before the term runs out, then continue with the next part, repeat.

but having only one, possibly large, assignment that isn't broken down is running the risk of kinda screwing up a lot of the students.

and "possibly large" is a very subjective thing. what if 10% of the class is overwhelmed, do you just leave them behind entirely? etc.

being a student

Being a student myself, One comment I have is that it would be much nicer if students are given the option of choosing the language themselves.

I have found the assignments much more rewarding when the choice of language is open. (Perhaps you can restrict the programming style - by specifying immutability of variables.)


I think it might be worth giving a choice of languages and a tangible problem to solve rather than something abstract. If my guess about your course is right, it is about "how different programming languages lend to different kinds of problem solutions".

For example, with MapReduce, if you don't parallelize it on a cluster, you might get slower performance that might leave your students wondering why they are parallelizing.

The PLT Scheme webserver (checkout the blog tutorial) might be a good source of ideas that might interest your students ... and I second Leon's suggestion that it be a problem that you've solved.