Non-Procedural
Programming (NPRG005), Summer
2026
Instructor: Adam
Dingle
In this course we will study logic programming and
functional programming by learning the languages Prolog and Haskell.
We will emphasize writing working code, and will use these languages
to solve a variety of problems.
lectures and other meetings
The lecture happens every Monday
from 10:40 – 12:10 in
room S4.
There are two tutorial sessions:
Adam Dingle holds office hours every Friday
from 13:00 - 14:00 at his office (room 405).
requirements
To successfully complete this class, you must:
Complete a number of programming exercises
through the semester, which your tutorial teacher will assign
weekly. You will need to earn at least 70% of the possible points
for these exercises.
Write a program in Prolog or Haskell as a
semester project. Here are some project
ideas. Please send your tutorial teacher a one-paragraph project
proposal by Sunday, May 3th. A
first working version of your project is due by Sunday, June
7th. The final version
of your project is due by Sunday, June
14th.
Take an exam at the end of the semester.
Regularly attend the lectures and tutorials.
You may not use GPT, Copilot or other AI
tools to generate any code or documentation that you submit in any
homework assignment or semester project in this course. Any use of
such tools is considered cheating and may disqualify you from passing
the class.
textbooks
other resources
Prolog
Haskell
syllabus
This will evolve as the semester proceeds, but
here is a rough plan for topics we will cover.
-
- Feb 16 (notes)
(exercises)
-
Course overview. Introduction to Prolog. Atoms. Equality.
Conjunction and disjunction. Predicates. Facts.
Rules. Recursive rules.
-
Feb 23 (notes)
(exercises)
-
Anonymous variables. Integers. Old-style arithmetic:
'is'. Arithmetic expressions. Comparisons. New-style
arithmetic: integer constraints. Searching
with integer constraints. Lists. Recursive predicates on
lists.
-
Mar 2 (notes)
(exercises)
-
Standard library predicates. Mode
indicators. Pure code. Floating-point
numbers and constraints. List
predicates, continued. Nested lists. Combinatorial recursion.
Structures.
-
Mar 9 (notes)
(exercises)
-
Operator syntax. Dictionaries. Defining
lists and natural numbers using structures. Higher-order predicates:
maplist, call. Matrices with nested lists. Searching in a state
space. Iterative deepening.
-
Mar 16 (notes)
(exercises)
-
Accumulators. Folds. Sorting. Functional
data structures. Queues. Binary trees.
The cut. Negation. If / then / else. Graphs.
Searching with a visited set. Breadth-first
search. Findall.
-
Mar 23 (notes)
(exercises)
-
Introduction to Haskell. Integer and boolean operators.
if/then/else. Defining functions. Type declarations. Pattern
matching. Lists. Type variables. Ranges. Characters. Strings.
Infinite lists.
-
Mar 30 (notes)
(exercises)
-
Tuples. Guards. 'let'. 'where'. Standard type classes. Numeric type
classes. Type defaulting. Type conversions. List comprehensions.
-
Apr 6 (exercises)
-
No lecture (Easter Monday)
-
Apr 13 (notes)
(exercises)
-
Maybe. 'case' expressions. Higher-order
functions. Lambda expressions. Curried functions. Operator sections.
Function composition. The '$' operator. Combinatorial recursion.
-
Apr 20 (notes)
(exercises)
-
Folds. Type synonyms. Algebraic datatypes.
Recursive data structures. Derived instances.
-
Apr 27 (notes)
(exercises)
-
Recursive value definitions. Kinds. Instance
declarations. Defining type classes. Functors. Foldables.
-
May 4
-
'do'.
Input and output. I/O actions. Files and streams.
Arrays.
Dynamic programming.
-
May 11
-
Either.
Modules. Packages. Random numbers. Applicative
functors. Random-access lists. Sets and dictionaries.
Graph
representations. Depth-first and breadth-first search. Searching in
state spaces.
-
May 18
-
Monads. Writing
monads. State with monads. Parser combinators. Priority queues.
Leftist heaps.