Listless in Seattle
He’s making a list
He’s checking it twice
He’s going to find out
Who’s naughty and nice
— J. Fred Coots and Haven Gillespie, “Santa Claus Is Comin’ to Town”, 1934
We have already covered a substantial amount of materials on list. In this chapter, we will discuss more ways to construct and process lists. The range notation made a cursory appearance in the chapter Data, data everywhere. In the section Free range numbers, we will discuss in some detail a number of methods to construct lists via the range notation. List comprehension, as will be presented in the section ¿Comprende?, is one of the most useful list construction and processing techniques to know. The usefulness of list comprehension is due to its compact notation, which can be used to produce lists of varying complexity. Finally, in the section Bool-like we will consider some functions that are the list counterparts of the boolean operators &&
and ||
. These boolean-like functions allow us to answer many yes-no questions about lists whose elements are not necessarily boolean values.