One of the difficulties of computer science is that many words, such as function, string or pattern , are used ambiguously in non-rigorous contexts. For example, with traditional regular expressions a pattern can occur anywhere in a piece of text. But for parser expression grammars the notion of pattern is different, and refers to initial segments of a text. RiscLua contains the Lpeg pattern-matching library. This introduces patterns as a new abstract datatype, thus avoiding the usual kludge of representing patterns as strings. A string can be thought of as a mapping from an initial segment of the positive integers into the set of characters. An element of a string thus determines two things: the offset of the element from the start of the string (where is it?), and the character at that offset (what is it?). Here are links to more details.