flâneur — a map of the web's best reading

4.2 Implicit Sequences

composingprograms.com · 4,817 words · saved by 1 readers

A sequence can be represented without each element being stored explicitly in the memory of the computer. That is, we can construct an object that provides access to all of the elements of some sequential dataset without computing the value of each element in advance. Instead, we compute elements on demand. An example of this idea arises in the range container type introduced in Chapter 2. A range represents a consecutive, bounded sequence of integers. However, it is not the case that each element of that sequence is represented explicitly in memory. Instead, when an element is requested from a range, it is computed. Hence, we can represent very large ranges of integers without using large blocks of memory. Only the end points of the range are stored as part of the range object. In this example, not all 999,990,000 integers in this range are stored when the range instance is constructed. Instead, the range object adds the first element 10,000 to the index 45,006,230 to produce the elem

4.2 Implicit Sequences c ⚬ mp ⚬ sing pr ⚬ grams Text Projects Tutor About Chapter 4 Hide contents 4.1 Introduction 4.2 Implicit Sequences 4.2.1 Iterators 4.2.2 Iterables 4.2.3 Built-in Iterators 4.2.4 For Statements 4.2.5 Generators and Yield Statements 4.2.6 Iterable Interface 4.2.7 Creating Iterables with Yield 4.2.8 Iterator Interface 4.2.9 Streams 4.2.10 Python Streams 4.3 Declarative Programming 4.3.1 Tables 4.3.2 Select Statements 4.3.3 Joins 4.3.4 Interpreting SQL 4.3.5 Recursive Select Statements 4.3.6 Aggregation and Grouping 4.4 Logic Programming 4.4.1 Facts and Queries 4.4.2 Recursi

Explore this link on the map →

related reading