DEV Community

Discussion on: Explain MapReduce like I'm five

Collapse
 
scottjoe profile image
Scott Williams

.map looks at everything you have in your hands, does the same thing to everything and gives you a new version of everything you have. Everything will have the same thing done to it! If you want everything to be twice as big as it is now, it can do that. Just remember that it gives you a whole new set of things back at the end.

.reduce looks at everything you have in your hands, does the same thing to everything and gives you something back. What it gives you back depends on what it does to each thing. Sometimes you want it to smush all your things together into one thing. Sometimes you want to pick out your favorites from the group. Just remember that it gives you back something in the end. It might be a little or a lot of things depending on what you asked it to do.