Page 260

as, with

These are pretty poor names in that they don't convey what they're about. I prefer

(in-html tag string)

and

(with-html tag expression ...)

Page 261

html-file

Graham's definition assumes lowercase 4-character file extensions with the period separator. This works for Mac's and Unix boxes and Windows 95, but not for Windows 3.1 and perhaps not for other systems.

Use make-pathname to create file names and put extensions in user-modifiable parameters, e.g.,

(defparameter *html-extension* "html"
  "The standard extension for HTML files.")

(defun html-file (base)
  (make-pathname :name base :type *html-extension*))

Page 263

map3

Graham's definition counts on tail-call elimination to avoid overflowing the stack on long lists. You can't assume this will happen in Common Lisp.

A more typical Common Lisp definition would be:

(defun map3 (fn lst)
  (do ((l lst (cdr l))
       (prev nil (car l)))
      ((null l) nil)
    (funcall fn (car l) prev (cadr l))))

"It takes a lot of rewriting to make a program simple."

Open up your skull and carve this into your brain.

mapc

mapc doesn't return nil. It returns its second argument.

Faculty: Chris Riesbeck
Time: Monday, Wednesday, Friday: 1pm - 2pm
Location:Annenberg G15

Contents

Important Links