I am using SBCL and I don't mind a compiler-specific solution. I have form that involves some structs and I would like to walk and modify some sub-forms but subst can't see behind structs:
CL-USER> (defstruct my-struct slot-1 slot-2)
MY-STRUCT
CL-USER> (make-my-struct :slot-1 'a :slot-2 'b)
#S(MY-STRUCT :SLOT-1 A :SLOT-2 B)
CL-USER> (subst 'b1 'b (make-my-struct :slot-1 'a :slot-2 'b))
#S(MY-STRUCT :SLOT-1 A :SLOT-2 B)
Is there a way to make a general subst that can traverse all lisp-native structures?
For sbcl, something like this might work.
This is assuming a lot of things, if you want to traverse into the value of slots, or traverse non-class values, it would need work.