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.16 Triangle<br />

3.16.1 The Program<br />

;;; TRIANG -- Board game benchmark.<br />

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

(defvar *board* (make-array 16. :initial-element 1))<br />

(defvar *sequence* (make-array 14. :initial-element 0))<br />

(defvar *a* (make-array 37. :initial-contents<br />

’(1 2 4 3 5 6 1 3 6 2 5 4 11 12<br />

13 7 8 4 4 7 11 8 12 13 6 10<br />

15 9 14 13 13 14 15 9 10<br />

6 6)))<br />

(defvar *b* (make-array 37. :initial-contents<br />

’(2 4 7 5 8 9 3 6 10 5 9 8<br />

12 13 14 8 9 5 2 4 7 5 8<br />

9 3 6 10 5 9 8 12 13 14<br />

8 9 5 5)))<br />

(defvar *c* (make-array 37. :initial-contents<br />

’(4 7 11 8 12 13 6 10 15 9 14 13<br />

13 14 15 9 10 6 1 2 4 3 5 6 1<br />

3 6 2 5 4 11 12 13 7 8 4 4)))<br />

(defvar *answer*)<br />

(defvar *final*)<br />

(setf (aref *board* 5) 0))<br />

(defun last-position ()<br />

(do ((i 1 (1+ i)))<br />

((= i 16.) 0)<br />

(if (= 1 (aref *board* i))<br />

(return i))))<br />

217

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

Saved successfully!

Ooh no, something went wrong!