anchor.diff:    (or (null symbol)
         (eq symbol :epsilon)
         (equal symbol '(:epsilon))))
  +
  +
  +;;;;;;;;;;
  +;; TRIE ;;
  +;;;;;;;;;;
  +
  +
  +(defun common-prefix (a b &optional (test #'equal))
  +  (when (and a b (funcall test (car a) (car b)))
  +    (cons (car a) (common-prefix (cdr a) (cdr b) test))))
  +
  +(defun prefix-split (a b &optional (test #'equal))
  +  (if (and a b (funcall test (car a) (car b)))
  +      (multiple-value-bind (prefix suffix-a suffix-b)
  +          (prefix-split (cdr a) (cdr b) test)
  +        (values (cons (car a) prefix) suffix-a suffix-b))
  +      (values nil a b)))
  +
  +(defun prefix-p (prefix list &optional (test #'equal))
  +  (if (null prefix)
  +      t
  +      (and (funcall test (car prefix) (car list))
  +           (prefix-p (cdr prefix) (cdr list) test))))
  +
  +;; Trie: (list (prefix . trie) ...)
  +(defun trie-insert (trie value)
  +  (cond
  +    ((null trie)
  +      (list (list value nil)))
  +    ((null value)
  +     (cons nil trie))
  +    (t
  +     (destructuring-bind ((prefix . suffixes) &rest rest) trie
  +       ;(print suffixes)
  +       (multiple-value-bind (new-prefix value-suffix old-prefix-suffix)
  +           (prefix-split value prefix)
  +         (if new-prefix
  +             ;; split this node
  +             (cons (cons new-prefix
  +                         (cond
  +                           ;; value equals old-prefix
  +                           ((and (null value-suffix) (null old-prefix-suffix))
  +                            `(nil ,@suffixes))
  +                           ;; value is a prefix of old-prefix
  +                           ((null value-suffix)
  +                            `(nil (,old-prefix-suffix . ,suffixes)))
  +                           ;; old-prefix is a prefix of value
  +                           ((null old-prefix-suffix)
  +                            (trie-insert suffixes value-suffix))
  +                           ;; unique members of value and old-prefix
  +                           (t
  +                            `((,value-suffix nil) (,old-prefix-suffix . ,suffixes)))))
  +                   rest)
  +             ;; next
  +             (cons (car trie) (trie-insert (cdr trie) value))))))))
  +
  +(defun map-trie (function trie)
  +  (labels ((visit (trie accum)
  +             (format t "~&t: ~A, a: ~A~&" trie accum)
  +             (if (car trie)
  +                 (destructuring-bind (prefix &rest suffixes) (car trie)
  +                   (visit suffixes (cons prefix accum)))
  +                 (funcall function (apply #'append (reverse accum))))
  +             (when (cdr trie)
  +               (visit (cdr trie) accum))))
  +    (when trie
  +      (visit trie nil))))
  +
  +
   
   ;;;;;;;;;
   ;; I/O ;;
  
positive.code:                             (cons (rec (car symbol))
                                    (rec (cdr symbol)))))))))
        (rec tree))))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; HIGHER ORDER FUNCTIONS ;;
  
negative.code:                   b))
         a))
  
  (defun multiple-value-reduce (function sequence &key initial-value-list)
    (let ((result initial-value-list))
      (map nil
  