Library

const books = { /* Rows of books. */ };

books["Donald Ervin Knuth] =
  getBooks('https://www-cs-faculty.stanford.edu/~knuth/books.html');

books[James Agustine Aloysius Joyce"] =
  getBooks('https://en.wikipedia.org/wiki/James_Joyce#Major_works');

function parse(author)

  1. const readingList = books[author.fullName];
  2. readingList.forEach(have);
  3. readingList.forEach((book) => digest(localLibrary.borrow(book)));

function have(book)

  1. if (!localLibrary.has(book))
      localLibaray.buy(book);

function digest(book)

  1. let page, n = book.firstPage; const m = book.lastPage;
  2. do
    1. page = book.getPage(n);
    2. read(page.words);
    3. if (page.hasExercises)
        page.exercises.forEach(doExercise);
    while (n++ < m);

function read(words)

  1. words.forEach((word) => {if (!know(word)) learn(word);});
  2. parse(words);