Update of /project/cl-utilities/cvsroot/cl-utilities In directory common-lisp.net:/tmp/cvs-serv13214
Modified Files: extremum.lisp Log Message: Probably fixed problem with START and END and error checking.
Date: Tue May 17 00:06:47 2005 Author: pscott
Index: cl-utilities/extremum.lisp diff -u cl-utilities/extremum.lisp:1.3 cl-utilities/extremum.lisp:1.4 --- cl-utilities/extremum.lisp:1.3 Fri May 13 21:45:09 2005 +++ cl-utilities/extremum.lisp Tue May 17 00:06:47 2005 @@ -41,7 +41,8 @@ http://www.cliki.net/EXTREMUM for the full specification. Additionally, START and END specify the beginning and ending indices of the part of the sequence we should look at." - (if (zero-length-p sequence) + (if (or (zero-length-p sequence) + (>= start (or end (length sequence)))) (restart-case (error 'no-extremum) (continue () :report "Return NIL instead" @@ -54,7 +55,8 @@ &key (key #'identity) (start 0) end) (if (eql key #'identity) (once-only (sequence predicate start end) - `(if (zero-length-p ,sequence) + `(if (or (zero-length-p ,sequence) + (>= ,start (or ,end (length ,sequence)))) (restart-case (error 'no-extremum) (continue () :report "Return NIL instead" @@ -89,7 +91,8 @@ if the KEY function is so slow that calling it less often would be a significant improvement; ordinarily it's slower." (declare (optimize (speed 3) (safety 0) (space 0) (debug 1))) - (if (zero-length-p sequence) + (if (or (zero-length-p sequence) + (>= start (or end (length sequence)))) (restart-case (error 'no-extremum) (continue () :report "Return NIL instead"
cl-utilities-cvs@common-lisp.net