Why would you memorise foreign vocab when you could just look up what you want to say in a dictionary or phrasebook?
It's a silly analogy, but there's some merit in the comparison. Searching documentation takes time - perhaps not that long, but enough that if you had to do it constantly you'd become frustrated very quickly. If you look at some code you wrote recently, it's almost certain that there's a bunch of standard library function calls in there that you didn't have to think twice about writing. The same goes for basic programming patterns. The more you expand your repertoire of memorised functions and patterns, the easier it becomes to go from design to code.