# HG changeset patch # User Steve Losh # Date 1598889759 14400 # Node ID d6cc6af60002c22b03ba97c5d6989c2ffdda4698 # Parent e389a847e003ab50e35ba6c7101278928414e7ee Optimize FOR ... AROUND Only bother counting if we actually need it. diff -r e389a847e003 -r d6cc6af60002 src/iterate.lisp --- a/src/iterate.lisp Mon Aug 31 12:01:31 2020 -0400 +++ b/src/iterate.lisp Mon Aug 31 12:02:39 2020 -0400 @@ -264,12 +264,14 @@ (with ,source = ,original) (with ,is-list = (typep ,source 'list)) (with ,len = (if ,is-list -1 (length ,source))) - (for ,i :from 0) - (,kwd ,var next (if ,is-list - (progn (unless ,source (setf ,source ,original)) - (pop ,source)) - (progn (when (= ,i ,len) (setf ,i 0)) - (elt ,source ,i)))))))) + (with ,i = -1) + (,kwd ,var :next (if ,is-list + (progn (unless ,source (setf ,source ,original)) + (pop ,source)) + (progn (incf ,i) + (when (= ,i ,len) + (setf ,i 0)) + (elt ,source ,i)))))))) (defclause-sequence ACROSS-FLAT-ARRAY INDEX-OF-FLAT-ARRAY