I can second the experience that learning things in order to solve a problem works great. I struggle when I just have to sit down and lear something from scratch, without any direct application to the knowledge. But as soon I can project concepts and theories onto a problem I want to solve, I have no issue learning new things.
Currently I learn a lot about relational algebra and algebraic semirings, because they are part of the theory behind constraint programming, which I use in a current project.