Quiz Stuff

Quiz 8; October 26; three minutes

  1. What are the names of the four ports of the port model for goal evaluation that we've discussed? Hint: Here's the first letter of each: c, e, r, f (one point for all four)
  2. We think of backtracking as moving through the goals of a query or rule in a particular direction. What is that direction? (½ point)
  3. For each of the following queries, indicate whether they succeed or fail. (½ point each)
    ?- length([1,2,3],Len).
    ?- append(A,B,[1,2,3]), writeln(A), fail.
    ?- member(X,[1,2,3]), member(X,[3,4,5]).
    
  4. Write a predicate p(N) that prints the numbers between 1 and N inclusive. It always succeeds. (1½ points)
    ?- p(3).
    1
    2
    3
    true.