Quiz Stuff

Quiz 9; November 7; 3'30"; 1½ points each

  1. Write a predicate second(?List,?Second) that is true iff Second is the second element of List. Examples:
    ?- second([a,b,c],S).
    S = b.
    
    ?- second([a,b,c],10).
    false.
    
    ?- second([a],S).
    false.
    
  2. Problems like the pit-crossing puzzle can be solved in Prolog by repeatedly applying a three-step process until a solution is found. Briefly, what are those three steps?