Reduce code in doc code examples.
Add `partition`.