Define a macro that eliminates this repetitive pattern:
(define-value-binding from ((var (if ascending (- from by) (+ from by))) from &key (to NIL to-p) (by 1) &aux (ascending (or (not to) (< from to)))) (declare (type real var from by) (type (or real null) to) (type boolean ascending)) (declare (ignore from)) (if to-p `(cond (,ascending (incf ,var ,by) (when (<= ,to ,var) (end-for))) (T (decf ,var ,by) (when (<= ,var ,to) (end-for)))) `(incf ,var ,by)))

Issue: Macro call that should be transformed by define-value-binding

Macro definition:
(defmacro define-value-binding (name (var &rest args) &body body)
  (let ((vars (lambda-fiddle:extract-lambda-vars (lambda-fiddle:remove-aux-part args))))
    (emit-binding-definition name var args body :extra-vars vars)))

Macroexpansion:
(define-direct-binding from (var from &key (to nil to-p) (by 1)) (let ((#:ascending176 (gensym #A((9) base-char . "ASCENDING"))) (#:from173 (gensym #A((4) base-char . "FROM"))) (#:to174 (gensym #A((2) base-char . "TO"))) (#:by175 (gensym #A((2) base-char . "BY")))) (values* (sb-int:quasiquote (with-interleaving (let* #S(sb-impl::comma :expr (list* (list #:from173 from) (list #:to174 to) (list #:by175 by) (list #:ascending176 (list (quote or) (list (quote not) #:to174) (list (quote <) #:from173 #:to174))) (loop for #:var172 in (lambda-fiddle:extract-lambda-vars (enlist var)) collect (list #:var172 (list (quote if) #:ascending176 (list (quote -) #:from173 #:by175) (list (quote +) #:from173 #:by175))))) :kind 0) (declare (ignorable #S(sb-impl::comma :expr #:ascending176 :kind 0) #S(sb-impl::comma :expr #:from173 :kind 0) #S(sb-impl::comma :expr #:to174 :kind 0) #S(sb-impl::comma :expr #:by175 :kind 0))) #S(sb-impl::comma :expr (sb-int:quasiquote (declare (type #S(sb-impl::comma :expr (quote real) :kind 0) #S(sb-impl::comma :expr var :kind 0)))) :kind 0) #S(sb-impl::comma :expr (sb-int:quasiquote (declare (type #S(sb-impl::comma :expr (quote real) :kind 0) #S(sb-impl::comma :expr #:from173 :kind 0)))) :kind 0) #S(sb-impl::comma :expr (sb-int:quasiquote (declare (type #S(sb-impl::comma :expr (quote real) :kind 0) #S(sb-impl::comma :expr #:by175 :kind 0)))) :kind 0) #S(sb-impl::comma :expr (sb-int:quasiquote (declare (type #S(sb-impl::comma :expr (quote (or real null)) :kind 0) #S(sb-impl::comma :expr #:to174 :kind 0)))) :kind 0) #S(sb-impl::comma :expr (sb-int:quasiquote (declare (type #S(sb-impl::comma :expr (quote boolean) :kind 0) #S(sb-impl::comma :expr #:ascending176 :kind 0)))) :kind 0)) #S(sb-impl::comma :expr nil :kind 0))) (let ((ascending #:ascending176) (from #:from173) (to #:to174) (by #:by175)) (declare (ignorable ascending from to by)) (declare (ignore from)) (if to-p (sb-int:quasiquote (cond (#S(sb-impl::comma :expr ascending :kind 0) (incf #S(sb-impl::comma :expr var :kind 0) #S(sb-impl::comma :expr by :kind 0)) (when (<= #S(sb-impl::comma :expr to :kind 0) #S(sb-impl::comma :expr var :kind 0)) (end-for))) (t (decf #S(sb-impl::comma :expr var :kind 0) #S(sb-impl::comma :expr by :kind 0)) (when (<= #S(sb-impl::comma :expr var :kind 0) #S(sb-impl::comma :expr to :kind 0)) (end-for))))) (sb-int:quasiquote (incf #S(sb-impl::comma :expr var :kind 0) #S(sb-impl::comma :expr by :kind 0))))))))