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 4: ARITHMETIC
Corrections
  • page 21, line -6: Change
    
    > (+ 12 4) 16
    
    to
    
    > (+ 12 4)
    16
    
  • page 26, line -3: (25 + 30) x 15/2
    should be read as (25 + 30) x (15/2)

Notes
  1. Read Chapter 4.

  2. Run XEmacs and ACL within it.

  3. Do Exercises 4.1 through 4.15.

  4. Divide your XEmacs window into two by typing C-x 2

  5. In one of the two XEmacs windows, start a file called ch4.cl by typing C-x C-f ch4.cl

  6. Note that the mode line of the ch4.cl window is "Common Lisp", which is the mode for creating Common Lisp source files.

  7. Cut and paste the following into your ch4.cl buffer:
    ----------------------- cut here -----------------------
    ;;; Answers to Chapter 4 Exercises
    
    ;;; 4.16
    ???
    
    ;;; 4.17a
    ???
    
    ;;; 4.17b
    ???
    
    ;;; 4.17c
    ???
    ----------------------- cut here -----------------------
    

  8. Save your ch4.cl file by typing C-x C-s while your cursor is inside its window.

  9. Use the *acl* window to work out the answers to Exercises 4.16 and 4.17.

    Each of the four answers is to be a Lisp form (a list in all four cases) that Lisp evaluates to be the same number that is the value of the expression shown in the book. For example, the value of the expression in 4.17b should be 18.8496, and the value of the expression in 4.17c should be about 32.76.

    When you have a correct form for each of the parts, copy it into the ch4.cl window, replacing the appropriate "???".

  10. When you are satisfied that you have 4.16 and 4.17 correct, save ch4.cl by entering C-x C-s inside its window.

  11. Submit your ch4.cl file by evaluating the Lisp form
    (shell "submit_cse202 ch4.cl")
    This is how you are to submit work in this course from now on, unless told otherwise.

Next

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

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