Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Why? You are reducing to a single number according to the data ops. The only time there is no operation on that number is for operation
o
, which just pushes the number to the main function's output array. Seems pretty straightforward.I've done it a bit differently in that my reduce function builds the main output array but I like this top solution, focusing on the number itself.
Using reduce as a quasi loop without even returning any reduced value is kind of ugly to my taste.