Library › Book 12 › Map, Filter, and Reduce
Map, Filter, and Reduce
14.1🔒OverviewObject-oriented programming organizes code around objects. Functional programming organizes code around transformations. In QA, you…
14.2🔒Transforming Collections with Mapmap applies a function to every element in a collection and returns a new collection of the results. The original collection is never…
14.3🔒Filtering Collectionsfilter selects elements that satisfy a predicate function. In QA, you filter failed tests, non-200 responses, slow test cases, and flaky…
14.4🔒Aggregating with Reducereduce collapses a collection into a single value by applying a function that accumulates results. It computes totals, averages, frequency…
14.5🔒Chaining TransformationsThe real power emerges when you chain map, filter, and reduce into pipelines. Each step is a pure transformation -- easy to read, easy to…
14.6🔒Exercises: Chapter 14Easy: Write a function in all three languages that takes a list of HTTP status codes and returns only the ones in the 2xx range (200-299).
14.7🔒Q&AQuiz: Chapter 141. What does map return when applied to an empty list? 2. In Python, why might you prefer a list comprehension over map with a lambda? 3…
14.8🔒Career Translation- Implemented data transformation pipelines using map, filter, and reduce to process test results, generating pass rates, failure…
14.9🔒Q&AInterview Depth CheckPrompt: Given a list of test results with name, status, duration, and retries, how would you compute the pass rate, average duration, and…