copyright and credits preface chapter 1: understan functional programming identifying a paradigm subdivi the procedural paradigm using the functional paradigm using a functional hybrid looking at object creation the stack of turtles a classic example of functional programming exploratory data analysis summary chapter 2: introducing essential functional concepts first-class functions pure functions higher-order functions immutable data strict and non-strict evaluation recursion instead of an explicit loop state functional type systems familiar territory learning some advanced concepts summary chapter 3: functions, iterators, and generators writing pure functions functions as first-class objects using strings using tuples and named tuples using generator expressions exploring the limitations of generators bining generator expressions cleaning raw data with generator functions using lists, dicts, and sets using stateful mappings using the bisect module to create a mapping using stateful sets summary chapter 4: working with collections an overview of function varieties working with iterables parsing an xml file parsing a file at a higher level pairing up items from a sequence using the itero function explicitly exten a simple loop applying generator expressions to scalar functions using any() and all() as reductions using leno and sum() using sums and counts for statistics using zip() to structure and flatten sequences unzipping a zipped sequence flattening sequences structuring flat sequences structuring flat sequences - an alternative approach using reversed() to change the order using enumerate() to include a sequence number summary chapter 5: higher-order functions using max() and min0 to find extrema using python lambda forms lambdas and the lambda calculus using the map() function to apply a function to a collection working with lambda forms and map() using map() with multiple sequences using the filter() function to pass or reject data using filter() to identify outliers the iter0 function with a sentinel value using sorted() to put data in order writing higher-order functions writing higher-order mappings and filters unwrapping data while mapping wrapping additional data while mapping flattening data while mapping structuring data while filtering writing generator functions buil higher-order functions with callables assuring good functional design review of some design patterns summary chapter 6: recursions and reductions simple numerical recursions implementing tail-call optimization leaving recursion in ce handling difficult tail-call optimization processing collections through recursion tail-call optimization for collections reductions and fol a collection from many items to one group-by reduction from many items to fewer buil a mapping with counter buil a mapping by sorting grouping or partitioning data by key values writing more general group-by reductions writing higher-order reductions writing file parsers parsing csv files parsing in text files with headers summary chapter 7: additional tuple techniques using tuples to collect data using named tuples to collect data buil named tuples with functional constructors avoi stateful classes by using families of tuples assigning statistical ranks wrapping instead of state changing rewrapping instead of state changing puting spearman rank-order correlation polymorphism and type-pattern matching summary chapter 8: the itertools module working with the infinite iterators counting with count() counting with float arguments re-iterating a cycle with cycle() repeating a single value with repeat() using the finite iterators assigning numbers with enumerate() running totals with accumulate() bining iterators with chain() partitioning an iterator with groupby0 merging iterables with zip_longest0 and zip() filtering with press() picking subsets with islice() stateful filtering with dropwhile0 and takewhile0 two approaches to filtering with filterfalse() and filter() applying a function to data via starmap0 and map() cloning iterators with tee() the itertools recipes summary chapter 9: more itertools techniques enumerating the cartesian product reducing a product puting distances getting all pixels and all colors performance analysis rearranging the problem bining two transformations permuting a collection of values generating all binations recipes summary chapter 10: the functools module function tools memoizing previous results with iru_cache defining classes with total ordering defining number classes applying partial arguments with partial() reducing sets of data with the reduce() function bining map() and reduce() using the reduce() and partial() functions using the map() and reduce() functions to sanitize raw data using the groupby0 and reduce() functions summary chapter 11: decorator design techniques decorators as higher-order functions using the functools update_wrapper0 functions cross-cutting concerns ite design preprocessing bad data ad a parameter to a decorator implementing more plex decorators plex design considerations summary chapter 12: the multiprocessing and threa modules functional programming and concurrency what concurrency really means the boundary conditions sharing resources with process or threads where benefits will accrue using multiprocessing pools and tasks processing many large files parsing log files - gathering the rows parsing log lines into namedtuples parsing additional fields of an access object filtering the access details analyzing the access details the plete analysis process using a multiprocessing pool for concurrent processing using apply() to make a single request using the map_async0, starmap_async(), and apply_async0 functions more plex multiprocessing architectures using the concurrent.futures module using concurrent.futures thread pools using the threa and queue modules designing concurrent processing summary chapter 13: conditional expressions and the operator module evaluating conditional expressions exploiting non-strict dictionary rules filtering true conditional expressions fin a matching pattern using the operator module instead of lambdas getting named attributes when using higher-order functions starmapping with operators reducing with operator module functions summary chapter 14: the pymonad library downloa and installing functional ition and currying using curried higher-order functions currying the hard way functional ition and the pymonad * operator functors and applicative functors using the lazy list() functor monad bind() function and the >> operator implementing simulation with monads additional pymonad features summary chapter 15: a functional approach to web services the request-response model injecting state through cookies considering a server with a functional design looking more deeply into the functional view nesting the services the wsgi standard throwing exceptions during wsgi processing pragmatic wsgi applications defining web services as functions creating the wsgi application getting raw data applying a filter serializing the results serializing data into json or csv formats serializing data into xml serializing data into html tracking usage summary chapter 16: optimizations and improvements memoization and caching speizing memoization tail recursion optimizations optimizing storage optimizing accuracy reducing accuracy based on audience requirements case study-making a chi-squared decision filtering and reducing the raw data with a counter object rea summarized data puting sums with a counter object puting probabilities from counter objects puting expected values and disying a contingency table puting the chi-squared value puting the chi-squared threshold puting the inplete gamma function puting the plete gamma function puting the odds of a distribution being random functional programming design patterns summary other books you may enjoy index