[comp.soft-sys.andrew] Flames bug?

nichols@parc.xerox.com (David Nichols) (07/20/90)

I tried using the post-by-keyword function, about which Flames.pgr claims

> The headers-keywords-folders mappings are considered in sequence; if one
matches, the rest of the mappings are not considered.

However, when I tried it, my messages were classifed into all the
mappings that matched.  The problem is in map-heads-keys-folders which
is supposed to return the list of folders that the mappings match for a
given message:

(defun map-heads-keys-folders (msg biglist)
  (cond ((null biglist) NIL)
        (T (append (let* ((ca (car biglist))
                          (cda (cdr ca)))
                     (mhkf msg
                           (car ca)
                           (car cda)
                           (car (cdr cda))
                           NIL))
                   (map-heads-keys-folders msg
                                           (cdr biglist))))))

This function, however, returns all the mapping that match because of the
  (append (stuff that matches the car) (recursive call to match the cdr))
form.  I changed it in my .AMS.flames files as follows, and it appears to work:

(defun my-map-heads-keys-folders (msg biglist)
  (cond ((null biglist) NIL)
        (T (let* ((ca (car biglist))
		  (cda (cdr ca))
		  (folders (mhkf msg
				 (car ca)
				 (car cda)
				 (car (cdr cda))
				 NIL)))
	     (cond (folders folders)
		  (T (my-map-heads-keys-folders msg (cdr biglist))))))))

I sure the more experienced flames/lisp hackers out there can improve on this.

	David