Circuits -- Reversible and Quantum Circuit Optimization: A Functional Approach --