anchor.diff:    (let ((table (make-hash-table :test #'equal))
           (clusters nil))
       (loop for (value count) in values
  -       do (let* ((trimmed-value (trim value))
  -                 (pattern (funcall simplifier trimmed-value))
  -                 (cluster (gethash pattern table (make-cluster :key pattern))))
  -            (add-sample cluster trimmed-value count)
  -            (setf (gethash pattern table) cluster)))
  +       do (funcall simplifier (trim value)
  +                   #'(lambda (value pattern)
  +                       (let ((cluster (gethash pattern table (make-cluster :key pattern))))
  +                         (add-sample cluster value count)
  +                         (setf (gethash pattern table) cluster)))))
       (maphash #'(lambda (pattern cluster)
                    (declare (ignore pattern))
                    (push cluster clusters))
  
positive.code: 
     This format follows https://en.wikipedia.org/wiki/List_of_postal_codes.
    "
    (map 'string #'(lambda (c) (cond ((latin-char-p c) #\A)
                                     ((digit-char-p c) #\N)
                                     ((or (char= #\- c) (char= #\. c)) #\Space)
                                     (T c)))
         (string-upcase postcode)))
  
  
  (defun get-phone-or-flat-pattern (phone)
    "Simplifies phone or flat numbers in the following way:
     * all letters are replaced by 'A'
     * all digits are replaced by 'N'
     * other characters are capitalized
    "
    (map 'string #'(lambda (c) (cond ((alpha-char-p c) #\A)
                                     ((digit-char-p c) #\N)
                                     (T c)))
         (string-upcase phone)))
  
  (defstruct type-settings
    pattern-simplifier
  
negative.code:               :phone ,(make-type-settings :pattern-simplifier #'get-phone-or-flat-pattern
                                            :field-name "contact:phone")
                :flat ,(make-type-settings :pattern-simplifier #'get-phone-or-flat-pattern
                                           :field-name "addr:flats")
                :house-number ,(make-type-settings :pattern-simplifier #'get-house-number-pattern
                                                   :field-name "addr:housenumber")
                :house-number-strings ,(make-type-settings
                                        :pattern-simplifier #'get-house-number-strings
                                        :field-name "addr:housenumber")))
  
  (defstruct cluster
    "A cluster of values with the same pattern, i.e.  all six-digits
  