Consider a function F that takes a function and produces a function based on structure of the input function. As an example consider F that takes all functions having at least two conditionals and swaps their conditional expressions. so
if condition(a, b, c) then calc1(z) else (calc(y) + (if condition1(a, m, k) then u else p ))
becomes
if condition1(a, b, c) then calc1(z) else (calc(y) + (if condition(a, m, k) then u else p ))
Do functions like these fit into category theory/computational science? How are they called? Would love any pointers on books/wikipedia articles about them.