Piotr Wozniak, the author of spaced repetition software SuperMemo, has a lengthy treatise on sleep, based on his long running research regarding memory and learning. His disk and RAM metaphor is a useful way to think about the relationship between knowledge and sleep.
A metaphor can help understand the role of sleep and why alarm clocks are bad. We can compare the brain and its NREM-REM sleep cycles to an ordinary PC. During the day, while learning and experiencing new things, you store your new data in RAM memory. During the night, while first in NREM, you write the data down to the hard disk. During REM, which follows NREM in the night, you do the disk defragmentation, i.e. you organize data, sort them, build new connections, etc. Overnight, you repeat the write-and-defragment cycle until all RAM data is neatly written to the disk (for long-term use), and your RAM is clear and ready for a new day of learning. Upon waking up, you reboot the computer. If you reboot early with the use of an alarm clock, you often leave your disk fragmented. Your data access is slow, and your thinking is confused. Even worse, some of the data may not even get written to the disk. It is as if you have never stored it in RAM in the first place. In conclusion, if you use an alarm clock, you endanger your data.