23.03.2013 Views

Performance and Evaluation of Lisp Systems - Dreamsongs

Performance and Evaluation of Lisp Systems - Dreamsongs

Performance and Evaluation of Lisp Systems - Dreamsongs

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.15 Puzzle<br />

3.15.1 The Program<br />

;;; PUZZLE -- Forest Baskett’s Puzzle benchmark,<br />

;;; originally written in Pascal.<br />

(eval-when (compile load eval)<br />

(defconstant size 511.)<br />

(defconstant classmax 3.)<br />

(defconstant typemax 12.))<br />

(defvar *iii* 0)<br />

(defvar *kount* 0)<br />

(defvar *d* 8.)<br />

(defvar piececount<br />

(make-array (1+ classmax) :initial-element 0))<br />

(defvar class<br />

(make-array (1+ typemax) :initial-element 0))<br />

(defvar piecemax<br />

(make-array (1+ typemax) :initial-element 0))<br />

(defvar puzzle (make-array (1+ size)))<br />

(defvar p (make-array (list (1+ typemax) (1+ size))))<br />

(defun fit (i j)<br />

(let ((end (aref piecemax i)))<br />

(do ((k 0 (1+ k)))<br />

((> k end) t)<br />

(cond ((aref p i k)<br />

(cond ((aref puzzle (+ j k))<br />

(return nil))))))))<br />

203

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!