From ... From: Erik Naggum Subject: Re: Upper/Lower Triangular Matrix-P? Date: 1998/03/07 Message-ID: <3098261354783105@naggum.no>#1/1 X-Deja-AN: 331681491 References: <6dqseb$5hk$1@news.uta.edu> mail-copies-to: never To: cjc9024@omega.uta.edu (CoRey) Organization: Naggum Software; +47 8800 8879; http://www.naggum.no Newsgroups: comp.lang.lisp * cjc9024@omega.uta.edu (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.