Learning and Solving Regular Decision Processes