You are a Common Lisp macro expert. Given this code pattern:
(-> (from :users) (where (:= :active 1)) (order-by :name))

Write a macro that addresses: Macro call that should be transformed by ->

Macro definition:
(defmacro -> (value &rest forms)
  "Smart threading macro that dispatches based on clause types returned by forms.

   This macro enables immutable query composition by threading clauses through
   query-state objects. Creates a single copy at the beginning, then destructively
   adds clauses for efficiency. Supports both v1 select-statements and composer query-states.

   Forms that evaluate to NIL are skipped, enabling conditional composition:
     (-> (from :users)
         (when active-only (where (:= :active 1)))
         (when sort-by-name (order-by :name)))

   Examples:
     ;; With composer clause
     (-> (from :users)
         (where (:= :active 1))
         (order-by :name))

     ;; With v1 select-statement (backward compatible)
     (-> (select (:id :name) (from :users))
         (where (:= :active 1))
         (order-by :name))

     ;; Conditional composition
     (-> (from :users)
         (when include-inactive (where (:= :active 0)))
         (when sort-by-date (order-by :created_at)))"
  (a:with-gensyms (threaded-var clause-var)
    `(let* ((,threaded-var ,value)
            ;; Convert to query-state and copy once at the beginning
            (,threaded-var
              (typecase ,threaded-var
                (query-state-base (copy-query-state-immutable ,threaded-var))
                (stmt:select-statement (select-statement-to-query-state ,threaded-var))
                (stmt:insert-into-statement (insert-statement-to-query-state ,threaded-var))
                (stmt:update-statement (update-statement-to-query-state ,threaded-var))
                (stmt:delete-from-statement (delete-statement-to-query-state ,threaded-var))
                (otherwise (add-clause (make-select-query-state) ,threaded-var)))))
       ;; Now destructively add clauses (no more copying), skipping NILs
       ,@(loop for form in forms
               collect `(let ((,clause-var ,(if (listp form)
                                                ;; For list forms, call the function with its arguments (no threading)
                                                `(,(car form) ,@(cdr form))
                                                ;; For symbol forms, call the function with no arguments
                                                `(,form))))
                          (when ,clause-var
                            (add-clause ,threaded-var ,clause-var))))
       ,threaded-var)))

Macroexpansion:
(let* ((#:threaded-var143 (from :users)) (#:threaded-var143 (typecase #:threaded-var143 (query-state-base (copy-query-state-immutable #:threaded-var143)) (stmt:select-statement (select-statement-to-query-state #:threaded-var143)) (stmt:insert-into-statement (insert-statement-to-query-state #:threaded-var143)) (stmt:update-statement (update-statement-to-query-state #:threaded-var143)) (stmt:delete-from-statement (delete-statement-to-query-state #:threaded-var143)) (otherwise (add-clause (make-select-query-state) #:threaded-var143))))) (let ((#:clause-var144 (where (:= :active 1)))) (when #:clause-var144 (add-clause #:threaded-var143 #:clause-var144))) (let ((#:clause-var144 (order-by :name))) (when #:clause-var144 (add-clause #:threaded-var143 #:clause-var144))) #:threaded-var143)