chickadee » phricken » sgm-rules

sgm-rulesparameter

sgm-rules is an alist mapping a type symbol to a transformer procedure. To transform, the appropriate procedure is looked up using the first field (type), and then the entire entry is passed to the procedure via apply. It is therefore natural to use the existing make-entry family of procedures here.

Here's the default definition of sgm-rules:

(define sgm-rules
  (make-parameter
   `((*default* . ,make-entry)
     (i . ,(lambda (type . msg)    (apply make-info-entry msg)))
     (3 . ,(lambda (type . msg)    (apply make-error-entry msg)))
     (h . ,(lambda (type name url) (make-url-entry name url))) )))

If the entry type is not found, the rule *default* is consulted; an error is signaled if no rules match.