I want to generate a replacement rule from a user-defined pattern. For example, the user provides a list of patterns {A[i_][j_], BB[k_]}
and a user-defined function F
, and I hope to generate {A[i_][j_]:>F[A[i][j], B[k_]:>F[B[k]}
.
I wonder how to achieve this?