Subject: Re: Upper/Lower Triangular Matrix-P? From: Erik Naggum <firstname.lastname@example.org> Date: 1998/03/07 Newsgroups: comp.lang.lisp Message-ID: <email@example.com> * firstname.lastname@example.org (CoRey) | ; BROKEN | (defun mat-upper-triangular (a) | (block nil | (dotimes (i (array-dimension a 0)) | (dotimes (j (array-dimension a 1)) | (when (< i j) | (format t "~A, ~A: ~A~%" i j (aref a i j)) | (if (not (equal (aref a i j) 0)) | (return nil))))) | (return t))) | ;; always does the last (return t), even if return nil evals! it appears that you think you need the BLOCK named NIL to use RETURN. this is not so. instead of RETURN, use RETURN-FROM, and exploit the fact that DEFUN creates a block with the same name as the function. (defun mat-upper-triangular (a) (dotimes (i (array-dimension a 0)) (dotimes (j (array-dimension a 1)) (when (< i j) (format t "~A, ~A: ~A~%" i j (aref a i j)) (unless (zerop (aref a i j)) (return-from mat-upper-triangular nil))))) t) #:Erik -- God grant me serenity to accept the code I cannot change, courage to change the code I can, and wisdom to know the difference.