wumpus and graph util for sbcl

108 views
Skip to first unread message

Tim Menzies

unread,
Feb 3, 2011, 11:56:11 PM2/3/11
to Land of Lisp
(standard apologies if this has already been posted)

i got wumpus going in sbcl with the following modifications to graph-
utils.lisp

all this source code is at http://unbox.org/wisp/var/timm/11/472/src/2/a/
(main load file = boot.lisp)

specific changes shown below.

comments? corrections? suggestions?

t

p.s. changed code:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;First: new global storing path name to dot:

(defparameter *dot* "/opt/local/bin/dot")

;;;;
; Second: change to the system call in dot->png

(defun dot->png (fname thunk)
(with-open-file (*standard-output*
(concatenate 'string fname ".dot")
:direction :output :if-exists :supersede)
(funcall thunk))
(shell->output *dot* "-Tpng" "-O" (format nil "~a.dot" fname)))

;;;;
; Third, a little library to handle shell calls in sbcl

(defun shell->output (com &rest args)
(with-open-stream (stream (shell com args))
(stream->list stream)))

(defun shell (com args)
(sb-ext:process-output
(sb-ext:run-program com args :output :stream)))

(defun stream->list (str)
(let ((line (read-line str nil nil)))
(if line
(cons line (stream->list str)))))
Reply all
Reply to author
Forward
0 new messages