The Department of Computer Science & Engineering
cse@buffalo

CSE202: Programming in Lisp

Course
Grades
Email

Welcome

Policies
    Grades
    Inc
    Intgrty

Preface
Part I
  Chap 1
  Chap 2
  Chap 3
  XEmacs
  Chap 4
  Chap 5
  Chap 6
  Chap 7
  Chap 8
  Chap 9
Part II
  Chap 10
  Chap 11
  Chap 12
  Chap 13
  Chap 14
  Chap 15
  Chap 16
  Chap 17
  Chap 18
  Chap 19
  Chap 20
  Chap 21
  Chap 22
  Chap 23
Part III
  Chap 24
  Chap 25
  Chap 26
  Chap 27
  Chap 28
  Chap 29
  Chap 30
  Chap 31
  Chap 32
CHAPTER 13: PREDICATE FUNCTIONS
Corrections
  1. page 84, lines 3 - 4: Change
    
    > (packagep (in-package 'test))
    T
    
    to
    
    > (packagep (defpackage test))
    T
    

  2. page 85, line 16: Change function to number.

  3. page 86, line 18: Change return to be.

Notes
  1. Do Exercises 13.1 - 13.3 to the extent you feel you need to in order to feel comfortable with these functions.

  2. Do Exercise 13.7, and then compare your definition with the one in Appendix A.

  3. Instead of doing Exercise 13.10, compare the behavior of the functions null and not You should not be able to find a difference.

  4. Create a file named ch13.cl with the following contents:
    ----------------------- cut here -----------------------
    ;;; 13.6
    ;;; When lisp:<= is called on three or more arguments,
    ;;; it returns True in case
    ;;; ???,
    ;;; and False otherwise.
    
    ;;; 13.8
    ;;; The value of (listp NIL) is
    ???
    
    ;;; 13.9 The function definition is
    ???
    
    ;;; 13.11
    ;;; The value of (atom 'a) is
    ???
    ;;; The value of (atom 5) is
    ???
    ;;; The value of (atom '(a)) is
    ???
    ;;; The value of (atom '()) is
    ???
    ;;; The value of (atom "string") is
    ???
    ----------------------- cut here -----------------------
    
    Replace the question marks with your answers, and submit the file.
    When you do Exercise 13.9 do not use lisp:consp in your definition.

  5. as directed in Exercise 13.12, create the file util.cl with the definition of the function elementp in it. Your defpackage form should look like
    (defpackage util
      (:export elementp))
    
    and don't forget the in-package form.
    Submit this file.

  6. Do Exercises 13.13 and 13.14. Exercise 13.14 asks you to modify your definition of variablep Instead of changing the definition that was already in your match.cl file, add the new definition at the end and comment out the old definition with the comment brackets #| and |# Your file will look partially like this:
    ;;; 12.2
    #|
    (defun variablep ...
    ...
      )
    |#
    
    ;;; 13.13
    (defun match-element ...
    ...
      )
    
    ;;; 13.14
    (defun variablep ...
    ...
      )
    

    Submit your revised match.cl

  7. From now on, comment your function definitions in match.cl or calculator.cl with the exercise for which you wrote the definition, so I will know when I review the file, even though you will be submitting several files with the same name.

  8. Notice that you will be submitting three files for Chapter 13.

Next

Copyright © 1999, 2000 by Stuart C. Shapiro. All rights reserved.

Stuart C. Shapiro <shapiro@cse.buffalo.edu>