Section 9

Text

Importing the vocabulary of a value, searching a string, crossing from text to number.

The course has handled texts since its first line, without ever doing anything to them but glue them end to end. The language is not destitute: its vocabulary is simply not handed over by default, it is imported — and this section is the first to ask for it.

It also closes what section 8 has just opened: the first text you want to read as a number is also the first error you catch for real.

In this section

  • 9.1The vocabulary is imported

    What the language hands over unasked stops at Console, System, File and its errors. The rest of the vocabulary is written in Archon, and is imported.

  • 9.2Searching a text

    Cleaning, questioning, locating — and the −1 convention, which is not the zero of absences.

  • 9.3From text to number, and back

    toInt raises a ParseError when the text is not a number, toText returns a str you can still work on.