Functional Python Programming
Recursions and Reductions In both cases, the result is iterable. We must do something following this to materialize a sequence o ...
Chapter 6 In Python, the product function can be defined recursively as follows: def prodrc(collection): if len(collection) == 0 ...
Recursions and Reductions This lacks the recursion limits. It includes the required tail-call optimization. Further, this will w ...
Chapter 6 A common operation that can be approached either as a stateful map or as a materialized, sorted object is computing th ...
Recursions and Reductions If we print Counter(quantized).most_common() function, we'll see the following results: [(30.0, 15), ( ...
Chapter 6 The internal group() function steps through the sorted sequence of data items. If a given item has already been seen – ...
Recursions and Reductions Grouping or partitioning data by key values There are no limits to the kinds of reductions we might wa ...
Chapter 6 The interior function handles our essential recursive definition. An empty collection returns the provided dictionary. ...
Recursions and Reductions This can also be written as an iteration as follows: def partition(key, data): dictionary= defaultdict ...
Chapter 6 0.1731 latitude(start(point)) 35.505665 Our initial point object is a nested three tuple with (0) - a starting p ...
Recursions and Reductions This allows us to define mean, standard deviation, normalized values, correction, and even least-squar ...
Chapter 6 It's important to note that this function is similar to other examples in that it actually returns a function rather t ...
Recursions and Reductions return (comma_split(coordinates.text) for coordinates in doc.findall("./ns0:Document/ns0:Folder/ns0:Pl ...
Chapter 6 This will build a tuple-of-tuple representation of each waypoint along the path in the original KML file. It uses a lo ...
Recursions and Reductions Following is the conversion: def float_none(data): try: data_f= float(data) return data_f except Value ...
Chapter 6 # 239 222 205 Almond 205 149 117 Antique Brass We can parse a text file using regular expressions. We need to use a fi ...
Recursions and Reductions Following is a higher-level parser command snippet: def color_palette(headers, row_iter): name, column ...
Additional Tuple Techniques Many of the examples we've looked at have either been scalar functions, or relatively simple structu ...
Additional Tuple Techniques Using an immutable namedtuple as a record In Chapter 3, Functions, Iterators, and Generators, we sho ...
Chapter 7 These definitions don't provide much guidance on the data types involved. We can use a simple naming convention to mak ...
«
3
4
5
6
7
8
9
10
11
12
»
Free download pdf