next up previous contents
Next: CHAPTER.7: THE POP-11 Up: CHAPTER.6: LIST PROCESSING Previous: More exercises on

Exercises on the meaning of the single and double up-arrows

Here are some puzzles to test your understanding. If we assign [a b] to x, thus:

    [a b] -> x;
then the list [^^x c] is [a b c] and the list [^x c] is [[a b] c].

What values would have to be assigned to x, y etc so that the following were true (some are impossible - which ones?):

    [^^x ^^x] = [a b a b]         ;;; answer is [a b] -> x;
    [^x ^^y] = [[a b] b c]        ;;; answer is [a b] -> x; [b c] -> y;
    [^^x mother ^^y] = [i love my mother]
    [the height of steve is ^^x] = [the height of steve is 70 inches]
    [every ^^x is a ^^y] = [every fire man is a civil servant]
    [every ^x is a ^y] = [every fire man is a civil servant]
    [^^x i ^^y you] = [sometimes i hate people like you]
    [[^x ^^y] ^^z] = [[a b c d]]
    [^x [^^y] ^z] = [[a b] [c d] [e f]]
    [i saw ^^n ships] = [i saw 3 ships]
    [i saw ^n ships] = [i saw 3 ships]
    [i ^x you] = [i hate computers]
    [^x ^y ^z] = [i hate computers]
Use the computer to check your answers. For example, if you think the answer to the fourth one is:

    [6 feet] -> x;
then try printing the list:

    [the height of steve is ^^x] =>
Later you will see that the procedure MATCHES could be used to find the answers.



Aaron Sloman
Fri Jan 2 03:17:44 GMT 1998