2

http://landoflisp.com/graph-util.lisp

(defun uedges->dot (edges);draw undirected graphs
  (maplist (lambda (lst)
         (mapc (lambda (edge)
                 (unless (assoc (car edge) (cdr lst))
                   (fresh-line)
                   (princ (dot-name (caar lst)))
                   (princ "--")
                   (princ (dot-name (car edge)))
                   (princ "[label=\"")
                   (princ (dot-label (cdr edge)))
                   (princ "\"];")))
               (cdar lst)))
       edges))

我以为这个功能有问题,有人可以解决吗?

4

1 回答 1

1

我自己解决了。我希望有人在研究 lisp p125 uedges-dot 函数的土地时保重。

(defun uedges->dot (edges);draw undirected graphs
 (maplist (lambda (lst)
     (mapc (lambda (edge)
         (unless (assoc (caar lst)
                        (cdr (assoc (car edge) (cdr lst))));<-----modify 'unless'
           (fresh-line)
           (princ (dot-name (caar lst)))
           (princ "--")
           (princ (dot-name (car edge)))
           (princ "[label=\"")
           (princ (dot-label (cdr edge)))
           (princ "\"];")))
       (cdar lst)))
   edges))
于 2012-08-24T10:42:29.980 回答