title: adjacency matrix/Floyd/Warshall in lisp
body: <p>Apparently my teacher believes that even if we don't have time to learn stuff (nor enough examples) we should move on, so I now need to know how to make Floyd-Warshall's and Warshall's algorithms in clisp.</p>
  
  <p>As I did with prolog, my problem is to generate the adjacency matrix from the graph, in this case it would be a list of lists, e.g.:</p>
  
  <pre><code>((A B) (A C) (A D) (B C) (C D))
  </code></pre>
  
  <p>That should generate:</p>
  
  <pre><code>((0 1 1 1) (1 0 1 9) (1 1 0 1) (1 9 1 0))
  </code></pre>
  
  <p>I've got this:</p>
  
  <pre><code>(defun floyd(graph)
      (setf l (length graph)) 
      (setf mat (matrix l graph))
  )
  
  (defun matrix(l graph)
      (setf matrix (make-array (list l l)))
      (dotimes (i l)
          (dotimes (j l)
              (if (= i j)
                  (setf (aref matrix i j) 0)
                  (setf (aref matrix i j) ???)
              )
          )
      )
      matrix
  )
  </code></pre>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>Also, and kind of off-topic: If I could solve my own question, should I reply myself for the sake of having an answered question?</p>