  We present a quantum algorithm to achieve higher-order transformations of
Hamiltonian dynamics. Namely, the algorithm takes as input a finite number of
queries to a black-box seed Hamiltonian dynamics to simulate a desired
Hamiltonian. Our algorithm efficiently simulates linear transformations of any
seed Hamiltonian with a bounded energy range consisting of a polynomial number
of terms in system size, making use of only controlled-Pauli gates and
time-correlated randomness. This algorithm is an instance of quantum functional
programming, where the desired function is specified as a concatenation of
higher-order quantum transformations. By way of example, we demonstrate the
simulation of negative time-evolution and time-reversal, and perform a
Hamiltonian learning task.
