Exam #2 Topics List
This is a study-guide for the final exam. In addition to reviewing the topics below, I recommend that you go back and make sure you understand the code covered in class and on the homework assignments. The online reference is also useful for studying. Our final exam will cover the material in Chapters 1–5 and 9–11 of the Prolog tutorial, though the exam is comprehensive and could therefore also cover some Haskell topics. You should be prepared for some compare-and-contrast kinds of questions as well, now that we've spent time with two distinct programming paradigms.
Terms and Topics
Be prepared to define and/or write code examples for the following terms:
- Facts in Prolog
- Prolog queries (including variables)
- Prolog variables (repeated use, etc)
- Simple rules in Prolog (non recursive)
- Recursive Prolog rules (defining them, search implications)
- Proof and deduction in Prolog
- Lists in Prolog (syntax, building lists, pattern-matching against, etc.)
- Prolog built-ins (
member
, plus
, append
, length
, etc.)
- Search trees
- Output (
write
, nl
)
- Structured data terms (e.g.
in
functors on final assignment)
- Negation (how to write it, impacts on meaning of programs)
-
findall
-
assert
and retract
- Cuts and their impact
We've also discussed several different programming paradigms at this point:
- Imperative Programming:
A programming paradigm based on statements that change a program's state (the values stored in global variables). Programming amounts to sequencing a series of state-changing operations, and therefore tends to focus on how a program produces its results.
- Declarative Programming:
Focuses on what a program should compute, without getting bogged down in how it happens. This is more of an ideal to strive for than a concrete paradigm, though some programming languages are more successful at achieving the declarative programming ideals than others.
- Functional Programming:
Treats computation as the evaluation of mathematical functions, thereby avoiding state and mutable data. It is often considered a declarative programming paradigm since programmers are often spared the need to think about low-level computational details (i.e. state-changing operations).
- Applicative Programming:
Solving problems by applying built-in (typically higher-order) functions rather than by creating new functions for the task.
- Logic Programming:
Treats computation as logical deduction given facts and rules expressed in first-order predicate logic. The purest example of declarative programming we've seen this semester. Prolog is one example of a Logic Programming language.