I think it's called "state-dependent learning". I did some practical and applied research on this when I was at Indiana University. It wasn't for credit, but it was truly the best education I had.
in reply to Coding while drunk
A friend from that time was alway drunk for his attendance-required Friday afternoon class, so he had to get drunk for his final. He aced it, but to this day he probably couldn't tell you the first thing about it, least of all what the subject was.
As God is my witness, I thought turkeys could fly.