Learning programs for the quantum computer