next up previous contents
Next: Use of the Up: CHAPTER.7: THE POP-11 Previous: Using matches to

Exercise

Using the previous definition as a model, define a procedure called FRIENDLY, which takes a list of words as input, and produces a result which is TRUE, or FALSE or UNDEF. The result should be TRUE if the list contains the words `LIKES YOU' and FALSE if the list contains the words `HATES YOU', and UNDEF if it contains neither. The definition can start:

    define friendly(list) -> result;
Hint: you'll need to use "==" as a pattern element more than once in the same pattern.

You may test your definition with commands like:

    friendly([everybody hates you today]) =>
    friendly([father christmas likes you ]) =>
    friendly([I can not bring myself to like you]) =>
What results should these print out?



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