From: Nikodemus S. <nik...@ra...> - 2012-05-30 05:20:44
|
On 30 May 2012 04:56, Paul Bowyer <pb...@ol...> wrote: I don't know what you think the error is. As is, the code compiles, and (defclass clx-dialog () ()) (set-var-info (make-instance 'clx-dialog) '(:g1 :g2)) (set-var-info nil '(:g1 :g2)) works as expected. Note that if you uncomment the first XLIB:DISPLAY-FINISH-OUTPUT while keeping the FORMAT call in place, you end up with a three-legged IF: ; caught ERROR: ; error while parsing arguments to special form IF: ; invalid number of elements in ; ((AND (NOT (NULL DINSTANCE)) (EQUAL (TYPE-OF DINSTANCE) 'CLX-DIALOG)) ; (FORMAT T "dinstance: ~A, groups: ~A~%" DINSTANCE GROUPS) ; (XLIB:DISPLAY-FINISH-OUTPUT *DISPLAY*) ; (LET ((VLST #) (GRPNO 0) (BOXNO 0) (INDEX 0) BLST) ; (FORMAT T "vlst: ~A, blst: ~A, grpno: ~A, boxno: ~A, index: ~A~%" VLST ; BLST GRPNO BOXNO INDEX))) ; to satisfy lambda list ; (SB-C::TEST SB-C::THEN &OPTIONAL SB-C::ELSE): ; between 2 and 3 expected, but 4 found ...which isn't going to work. You need to eg. wrap the them in a PROGN, (progn (Format t "dinstance: ~A, groups: ~A~%" dinstance groups) ;; (xlib:display-finish-output *display*) ) or use COND. You might also want to use TYPEP instead of EQUAL TYPE-OF, and the MAKE-LIST :INITIAL-ELEMENT probably isn't what you want: '('()) == (list '(quote nil)). I'm assuming you probably want plain '() == NIL. (defun set-var-info (dinstance groups) (cond ((typep dinstance 'clx-dialog) (Format t "dinstance: ~A, groups: ~A~%" dinstance groups) #+nil (xlib:display-finish-output *display*)) (t (let ((vlst (make-list (length groups) :initial-element '())) (grpno 0) (boxno 0) (index 0) blst) (format t "vlst: ~A, blst: ~A, grpno: ~A, boxno: ~A, index: ~A~%" vlst blst grpno boxno index) #+nil (xlib:display-finish-output *display*))))) Cheers, -- Nikodemus |