Re: Compilation error with structures (:type list)
All can disregard this thread; I need to learn to try my
'broken' examples in fresh instances of Lispworks
before complaining about them.
On 12/24/06, Taylor, Joshua <tayloj@rpi.edu> wrote:
> Hello all, I'm having some trouble compiling some code which specifies
> the that structures are to be stored using lists. I've distilled my problem down
> to the following example. If I omit the (:type list) from the
> structure definitions,
> I have no problem compiling. I'm using LW4.4.5 on Mac OS X.
>
> ;;;;;;;;;;;;;;;;;;;;;
>
> (defstruct (coordinate (:type list))
> x y)
>
> (defstruct (peg (:type list))
> player coordinate)
>
> (defstruct (piece (:type list))
> peg1 peg2)
>
> (defclass board ()
> ((pieces :initform () :reader board-pieces)))
>
> (defun find-piece (board pos1 pos2)
> (find-if
> #'(lambda (piece)
> (or (and (equal pos1 (peg-coordinate (piece-peg1 piece)))
> (equal pos2 (peg-coordinate (piece-peg2 piece))))
> (and (equal pos2 (peg-coordinate (piece-peg1 piece)))
> (equal pos1 (peg-coordinate (piece-peg2 piece))))))
> (board-pieces board)))
>
> ;;;;;;;;;;;;;;;;;;;;;
>
> When I try to compile a buffer containing this, I get the following output:
>
> ;;; Compiling file /Users/tayloj/problems.lisp ...
> ;;; Safety = 3, Speed = 1, Space = 1, Float = 1, Interruptible = 0
> ;;; Compilation speed = 1, Debug = 2, Fixnum safety = 3
> ;;; Source level debugging is on
> ;;; Source file recording is on
> ;;; Cross referencing is on
> ; (TOP-LEVEL-FORM 1)
> ; (SUBFUNCTION COORDINATE-Y (DEFSTRUCT COORDINATE))
> ; (SUBFUNCTION COORDINATE-Y (DEFSTRUCT COORDINATE))
> ; (SUBFUNCTION COORDINATE-X (DEFSTRUCT COORDINATE))
> ; (SUBFUNCTION COORDINATE-X (DEFSTRUCT COORDINATE))
> ; (SUBFUNCTION |set COORDINATE-Y| (DEFSTRUCT COORDINATE))
> ; (SUBFUNCTION |set COORDINATE-Y| (DEFSTRUCT COORDINATE))
> ; (SUBFUNCTION (DEFSETF COORDINATE-Y) (DEFSTRUCT COORDINATE))
> ; (SUBFUNCTION |set COORDINATE-X| (DEFSTRUCT COORDINATE))
> ; (SUBFUNCTION |set COORDINATE-X| (DEFSTRUCT COORDINATE))
> ; (SUBFUNCTION (DEFSETF COORDINATE-X) (DEFSTRUCT COORDINATE))
> ; (SUBFUNCTION MAKE-COORDINATE (DEFSTRUCT COORDINATE))
> ; (SUBFUNCTION MAKE-COORDINATE (DEFSTRUCT COORDINATE))
> ; (SUBFUNCTION PEG-COORDINATE (DEFSTRUCT PEG))
> ; (SUBFUNCTION PEG-COORDINATE (DEFSTRUCT PEG))
> ; (SUBFUNCTION PEG-PLAYER (DEFSTRUCT PEG))
> ; (SUBFUNCTION PEG-PLAYER (DEFSTRUCT PEG))
> ; (SUBFUNCTION |set PEG-COORDINATE| (DEFSTRUCT PEG))
> ; (SUBFUNCTION |set PEG-COORDINATE| (DEFSTRUCT PEG))
> ; (SUBFUNCTION (DEFSETF PEG-COORDINATE) (DEFSTRUCT PEG))
> ; (SUBFUNCTION |set PEG-PLAYER| (DEFSTRUCT PEG))
> ; (SUBFUNCTION |set PEG-PLAYER| (DEFSTRUCT PEG))
> ; (SUBFUNCTION (DEFSETF PEG-PLAYER) (DEFSTRUCT PEG))
> ; (SUBFUNCTION MAKE-PEG (DEFSTRUCT PEG))
> ; (SUBFUNCTION MAKE-PEG (DEFSTRUCT PEG))
> ; (SUBFUNCTION PIECE-PEG2 (DEFSTRUCT PIECE))
> ; (SUBFUNCTION PIECE-PEG2 (DEFSTRUCT PIECE))
> ; (SUBFUNCTION PIECE-PEG1 (DEFSTRUCT PIECE))
> ; (SUBFUNCTION PIECE-PEG1 (DEFSTRUCT PIECE))
> ; (SUBFUNCTION |set PIECE-PEG2| (DEFSTRUCT PIECE))
> ; (SUBFUNCTION |set PIECE-PEG2| (DEFSTRUCT PIECE))
> ; (SUBFUNCTION (DEFSETF PIECE-PEG2) (DEFSTRUCT PIECE))
> ; (SUBFUNCTION |set PIECE-PEG1| (DEFSTRUCT PIECE))
> ; (SUBFUNCTION |set PIECE-PEG1| (DEFSTRUCT PIECE))
> ; (SUBFUNCTION (DEFSETF PIECE-PEG1) (DEFSTRUCT PIECE))
> ; (SUBFUNCTION MAKE-PIECE (DEFSTRUCT PIECE))
> ; (SUBFUNCTION MAKE-PIECE (DEFSTRUCT PIECE))
> ; (DEFCLASS BOARD)
>
>
> **++++ Error in FIND-PIECE:
> COORDINATE is an illegal type specifier.
> ; (TOP-LEVEL-FORM 2)
> ; *** 1 error detected, no fasl file produced.
> ;;; Compilation finished with 0 warnings, 1 error.
>
> ---- Press space to continue ----
>
>
> --
> =====================
> Joshua Taylor
> tayloj@rpi.edu
>
> "A lot of good things went down one time,
> back in the goodle days."
> John Hartford
>
--
=====================
Joshua Taylor
tayloj@rpi.edu
"A lot of good things went down one time,
back in the goodle days."
John Hartford