# Final Exam Studyguide

### Topics

1. Functional programming and scheme (Chapter 10 Sec. 1-5 of the text and Lecture on scheme).
1. evaluating S-expressions and the substitution model of evaluation. normal vs. applicative order.
2. recursive functions in scheme
3. data structures and list processing in scheme
4. higher order functions (functions that are passed or return functions). E.G. map, filter, reduce, currying.
2. Streams and delayed evaluation (Chapter 10 Sec. 4 of the text and Chapter 3 Sec. 1 and 4 of SICP), and Lecture on streams).
1. stream processing with map, filter, reduction, etc.
2. delay and force
3. thunks and implementing delay and force.
3. Lambda Calculus (10 Sec. 6 of the text and Lecture on lambda calculus).
1. Substitution model of computation (abstraction and application)
2. free and bound variables
3. alpha conversion and beta reduction and Church-Rosser
4. universality of lambda calculus (arithmetic, boolean logic, conditionals, lists, and recursion).
4. Environments and the scheme interpreter (Chapter 4 Sec. 1-2 of SICP). and Lecture on scheme interpreter).
1. why assignment can not be modeled with substitution
2. environments - use and implementation
3. scheme interpreter from SICP
4. static vs. dynamic scope
5. delayed evaluation
5. Logic programming and prolog (chapter 11 of the text and Chapter 4 Sec. 4 of SICP, and Lecture on logic programming and the query language).
1. Horn clauses
2. Resolution and unification
3. Prolog syntax and evaluation
4. Prolog's search strategy (depth-first search and backtracking)
5. Search order makes a difference - why?
6. controling search with cut!

### What you should be able to do

1. Write a recursive scheme function and use and manipulate lists, including recursive data structures (e.g. trees).
2. Write and use higher-order scheme functions
3. Use substitution model of function application and lambda calculus.
4. Use environment model of function application
5. Trace through the execution of the scheme interpreter
6. Understand the difference between static and dynamic scope and normal and applicative order.
7. Write simple prolog rules to specify computation
8. Reduce a horn clause using resolution and unification
9. Trace through prolog evaluation (resolution, unification, and search with backtracking)
10. Understand the consequences of cut on prolog search

### Review Session

I will also be available during my normal office hours T 7-9 online to answer questions on the above material.

### Format

Students will have three and a half hours to take the exam once it is started. The exam is open book and open notes including online links from the lecture notes and assignment solutions. The exam must be taken in the window from June 3 (9am) to June 14 (9am). The exam must be done alone using only the explicitly mentioned resources. I truce everyone to follow these instructions and failure to do so will result in explusion from the class.

There will be four questions (with multiple parts): 1) functional programming and scheme, 2) substitution model and lambda calculus, 3) scheme interpreter, environments, and delayed evaluation 4) Query language and logic programming and prolog