anchor.diff:      :fillcolor "#fafafa"
       :color "#aaaaaa"
       :fontsize 22
  -    :width 0.05
  -    ))
  -
  -(defmethod cl-dot:graph-object-node ((graph (eql 'zdd))
  -                                     (object cons))
  +    :width 0.05))
  +
  +(defmethod cl-dot:graph-object-node ((graph (eql 'zdd)) (object node))
     (make-instance 'cl-dot:node
  -    :attributes (ematch (car object) ((sink c) (sink-attrs c)))))
  -
  -(defmethod cl-dot:graph-object-node ((graph (eql 'zdd))
  -                                     (object leaf))
  +    :attributes (ematch object
  +                  ((node v) `(:label ,v
  +                              :shape ,(if (funcall *draw-hex-p* v)
  +                                        :hexagon
  +                                        :circle))))))
  +
  +(defmethod cl-dot:graph-object-node ((graph (eql 'zdd)) (object cons))
  +  (cl-dot:graph-object-node graph (car object)))
  +
  +(defmethod cl-dot:graph-object-node ((graph (eql 'zdd)) (object leaf))
     (make-instance 'cl-dot:node
       :attributes (ematch object ((sink c) (sink-attrs c)))))
   
  +
   (defun wrap-node (object)
  -  (if *draw-unique-sinks*
  -    object
  -    (ematch object
  -      ((sink) (cons object nil))
  -      ((node) object))))
  +  (ematch object
  +    ((sink) (if *draw-unique-sinks* object (cons object nil)))
  +    ((node) (if *draw-unique-nodes* object (cons object nil)))))
   
   (defmethod cl-dot:graph-object-points-to ((graph (eql 'zdd))
                                             (object t))
     (ematch object
  -    ((sink _) '())
  -    ((cons (sink) _) '())
  +    ((cons object _)
  +     (cl-dot:graph-object-points-to graph object))
  +    ((sink _)
  +     '())
       ((node _ hi lo)
        (list (attrs (wrap-node hi) :style :solid)
              (attrs (wrap-node lo) :style :dashed)))))
   
  -(defun draw (zdd &optional (filename "zdd.png"))
  -  (cl-dot:dot-graph
  -    (cl-dot:generate-graph-from-roots 'zdd (list (wrap-node zdd)))
  -    filename
  -    :format :png)
  +
  +(defun draw (zdd &key
  +             (filename "zdd.png")
  +             (unique-sinks nil)
  +             (unique-nodes t)
  +             (hexp #'never))
  +  (let ((*draw-unique-sinks* unique-sinks)
  +        (*draw-unique-nodes* unique-nodes)
  +        (*draw-hex-p* hexp))
  +    (cl-dot:dot-graph
  +      (cl-dot:generate-graph-from-roots 'zdd (list (wrap-node zdd)))
  +      filename
  +      :format :png))
     zdd)
   
   
  
positive.code:                         )
    )
  
  (let ((*draw-unique-sinks* t))
    (with-zdd
      (-<> (make-rule-tree *rules*)
        ; (print-enumerated <>)
        ; (zdd-keep-avoiders-of <> '(2 7))
        (mapprint-through #'enumerate <>)
        (print-through #'zdd-count <>)
        (print-through #'zdd-size <>)
        (draw <>)
        ; (zdd-size <>)
        (never)
        )
      (pr '--------------)
      (-<> (apply #'zdd-family *state*)
        (mapprint-through #'enumerate <>)
        (print-through #'zdd-count <>)
        (print-through #'zdd-size <>)
        ; (draw <>)
        ; (zdd-size <>)
        (never)
        )
      (pr '--------------)
      (-<> (apply-rule-tree (apply #'zdd-family *state*)
                            (make-rule-tree *rules*)
                            100)
        (mapprint-through #'enumerate <>)
        (print-through #'zdd-count <>)
        (print-through #'zdd-size <>)
        ; (draw <>)
        ; (zdd-size <>)
        (never)
        )
      ))
  
  
  (defun test ()
  
negative.code:         :test #'equal))))
  
  
  (with-zdd
    (-<> (zdd-family
           '(1 2 100 200 6000)
           '(100 200 300)
           '(99 100 200 300)
           '(1 9900)
           '()
           '(1 2 1001)
           )
      (mapprint-through #'enumerate <>)
      (print-through #'line <>)
      (zdd-match <> '(100 200) 100 999)
      (mapprint-through #'enumerate <>)
      (draw <> :hexp (lambda (v) (>= 999 v 100)))
      (never <>)
      ))
  