I know that this is based on the existing example, but that is a bit outdated.

We now do unit-testing to make sure things work and examples to illustrate how to use them.
Could you move all the checks/assertions to a unit test (in the same way you did with the old ones)
And then make the example just a few lines how to produce the folds?