Skip to content

Instantly share code, notes, and snippets.

@iyahoo
Created October 29, 2016 13:16
Show Gist options
  • Save iyahoo/04087b02996ee0156ab995764ff68e0f to your computer and use it in GitHub Desktop.
Save iyahoo/04087b02996ee0156ab995764ff68e0f to your computer and use it in GitHub Desktop.
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(defun main (n &rest argv)
(declare (ignore argv))
(let* ((nth (parse-integer n))
(adj-mat (make-array (list nth nth))))
(loop :for i :to (1- nth) :do
(loop :for j :from i :to (1- nth) :do
(if (= i j)
(setf (aref adj-mat i j) 0)
(let ((random-number (random 10)))
(setf (aref adj-mat i j) random-number)
(setf (aref adj-mat j i) random-number)))))
(format t "~a~%" adj-mat)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment