4 Looking and finding

This chapter covers

  • How computer programs are made
  • Building a simple computer program for searching
  • Measuring and improving a program’s speed

When writing a book, it is important to be able to efficiently wrangle a long piece of text. One important task is to search for a word, finding where it has been used. We may then jump to such a position in the text, see what is around the word, and modify or replace it. We need to do this on demand, without an explicitly prepared index. In fact, we have indexes at the back of books because searching through the book manually, from front to back, is slow and error prone for a human. Luckily, it is fast and accurate for a computer. In this chapter, we will learn how to write ...

Get How Computers Make Books now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.