|CIS 554 -- Final Exam
Read each question carefully. Keep answers short and to the point. Do not provide any information that was not asked for; you may lose points that way.
- (50 points) Complete the following definitions as precisely as you can. Use one sentence, do not give examples.
- In resolution theory, a clause is...
- A homoiconic language is...
- A language is Turing complete if...
- A persistent data structure is...
- A lazy data structure is...
- Metaprogramming is...
- A collection of values of type A is covariant if...
- Dynamic typing is...
- A closure is...
- An actor is...
- (5 points) What did Tony Hoare refer to as his "billion dollar mistake"?
- (5 points) Of the languages that we have studied,
- Which language had the simplest syntax?
- As briefly as possible, describe that syntax.
- (5 points) In symbols rather than words, what is the resolution principle?
- (5 points) Unification is an essential operation in Prolog. For each of the following,
tell (1) whether the two expressions can be unified (answer "yes" or "no"), and (2) if "yes," what values are given
to each of the variables. (Remember, variables begin with a capital letter.)
mother(john, Dick) = mother(Jack, richard)
mother(tom, Dick) = mother(Dick, harry)
Me = grandpaw(Me, myself)
- (4 points) Here is some code from one of my REBOL programs:
last-part: last split-path pick image-files n clear find last-part #"."
clear are functions that take a single argument,
find are functions that take two arguments,
n are data values.
Add parentheses to this line to make the structure explicit.
- (6 points)
- Give one reason for claiming that REBOL is a functional language.
- Give one reason for claiming that REBOL is not a functional language.
- (5 points) Give two examples of a monad in Scala.
- (2 points) We have studied two domain-specific languages. One of them was Graphviz. What was the other one?
- (3 points) Using an example, write a description of currying.
- (5 points) Suppose you have a program to evaluate a large variety of algebraic expressions. Because algebraic expressions can be nested, the methods that do the evaluations must be recursive.
- What would be the advantage of writing these methods to be tail recursive?
- In addition to being a little extra effort, what would be the disadvantage of writing them to be tail recursive?
- Should you write these methods in a tail-recursive fashion? Why or why not?
- (5 points) In any functional language, lists are much more important than arrays, and are used much more often. Why?