Function: cps--handle-loop-for
cps--handle-loop-for is a byte-compiled function defined in
generator.el.gz.
Signature
(cps--handle-loop-for VAR)
Documentation
Support iter-by in loop.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/generator.el.gz
(defun cps--handle-loop-for (var)
"Support `iter-by' in `loop'."
;; N.B. While the cl-loop-for-handler is a documented interface,
;; there's no documented way for cl-loop-for-handler callbacks to do
;; anything useful! Additionally, cl-loop currently lexbinds useful
;; internal variables, so our only option is to modify
;; cl--loop-args. If we substitute a general-purpose for-clause for
;; our iterating clause, however, we can't preserve the
;; parallel-versus-sequential `loop' semantics for for clauses ---
;; we need a terminating condition as well, which requires us to use
;; while, and inserting a while would break and-sequencing.
;;
;; To work around this problem, we actually use the "for var in LIST
;; by FUNCTION" syntax, creating a new fake list each time through
;; the loop, this "list" being a cons cell (val . it).
(let ((it-form (pop cl--loop-args)))
(setf cl--loop-args
(append
`(for ,var
in (cps--initialize-for ,it-form)
by 'cps--advance-for)
cl--loop-args))))