3 ms·
Map and reduce are not hard if taught correctly. You have a list of N elements and want to trasform it into another list of N elements -> map You have a list
by 1_player 6y ago
Map and reduce are not hard if taught correctly.
You have a list of N elements and want to trasform it into another list of N elements -> map
You have a list and want to transform it into a single value -> reduce
Fin.
But hey, you ask, can’t a list be considered a single value? Yes, of course, so map can be implemented using reduce, making it the most useful FP construct