Module Information

Module Identifier
CS12510
Module Title
Functional Programming
Academic Year
2017/2018
Co-ordinator
Semester
Semester 1
Pre-Requisite
Should have substantial programming experience
Other Staff

Course Delivery

Delivery Type Delivery length / details
Lecture 22 x 1 Hour Lectures
Practical 10 x 1 Hour Practicals
 

Assessment

Assessment Type Assessment length / details Proportion
Semester Assessment Mid-semester in-class test  30%
Semester Exam 2 Hours   Exam  70%
Supplementary Exam 2 Hours   Supplementary Exam  100%

Learning Outcomes

On successful completion of this module students should be able to:

1. Describe and explain the key differences between procedural and functional programming

2. Demonstrate an ability to write small programs in Haskell

3. Demonstrate an understanding of how a compiler evaluates and executes programs

4. Demonstrate the use of key computing concepts such as types and recursion when programming.

Aims

The module aims to expose students to a different style of programming. It provides an introduction to programming language theory and what makes programming languages useful. It aims to demonstrate the options open to those who wish to design or use new programming languages.

Brief description

This module introduces functional programming and contrasts functional programming with imperative/procedural styles of programming. The module uses the pure functional language Haskell, which is a good vehicle for teaching programming concepts such as types, functions, evaluation order, side effects and proof of correctness.

Content

The module will be taught using two 1 hour lectures per week, one of which is in a conventional lecture room, and the other is in a computer laboratory so that short presentations can be interspersed with practical demonstrations. There will also be a one hour practical each week starting from week 2, with demonstrator support.
Week 1: Introduction and types: resources, module structure, the programming environments. Basic types (Ints, Floats, Chars, Strings). The interpreter, and the evaluation of simple expressions. Editing, saving and loading code.
Week 2: Language constructs: How we write Haskell programs. Variables, local definitions, functions, choice, etc. Comments. Evaluation of expressions rather than sequencing of instructions.
Week 3: Lists and tuples: The basic data structures. Tuples as "small objects" and as structured types (via type synonyms). The structure of lists. Functions on lists. The use of map/filter etc. rather than looping. List comprehensions.
Week 4: Recursion. Definition, examples, recursive thinking. Comparison to iteration.
Week 5: Higher order functions. Producing functions and consuming/using/applying functions. The types of functions.
Week 6: Data types. Defining new types. Why new data types are useful. The separation of data and functions. Abstraction via data, functions and modules.
Week 7: Mid semester in-class test. Laziness and evaluation order. Halting and efficiency.
Week 8: IO and purity. More on evaluation order. Side effects.
Week 9: Reasoning, proof and testing. Including HUnit and QuickCheck or similar frameworks.
Week 10: Review and revision classes

Module Skills

Skills Type Skills details
Application of Number Inherent in subject
Communication Documenting code
Improving own Learning and Performance From feedback (automatic feedback from computer and in-practical feedback from demonstrators)
Information Technology Inherent in subject
Personal Development and Career planning
Problem solving Solving design problems
Research skills Using a computer. Searching the language documentation.
Subject Specific Skills Programming skills, debugging skills
Team work

Notes

This module is at CQFW Level 4