next up previous contents
Next: More exercises on Up: CHAPTER.6: LIST PROCESSING Previous: Iteration vs Recursion

Exercises

What should the following print out? Which of the expressions produce words, and which produce lists? (Work out your won answers and write them down before running the commands in Pop-11).

    last(hd([[tom brown] [mary green] [suzy white]])) =>

    last(last([[tom brown] [mary green] [suzy white]])) =>

    hd(hd([[tom brown] [mary green] [suzy white]]))=>

    hd(tl([[tom brown] [mary green] [suzy white]]))=>

    tl(hd([[tom brown] [mary green] [suzy white]]))=>

    tl(tl([[tom brown] [mary green] [suzy white]]))=>


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