Primary Elements

The basic building blocks of the language are numbers, strings and expressions that combine them.

Q: "hello world"
A: hello world

This example outputs a string of characters.

Literal strings like this are parsed for one special character: the percent sign. This is an escape character that encodes for other characters, including control characters and delete. When a percent sign is found, the encoding expects the next two characters to be hex digits producing a one-byte hex value. That hex value is then added to the internal representation of the string, allowing you to incorporate otherwise unavailable characters into a string. Since the percent is used as the escape key, to actually get a percent into a string you must use %25, the hex value of percent.

Strings aren’t the only primitives:

Q: 6000
A: 6000

This above example demonstrates an integer. You can also do math:

Q: (8+3)*6
A: 66

Primary elements include parenthetical expressions like (8+3) above. These primary elements can be teased apart as well:

Q: substrings separated by "-" of "an-over-hyphenated-string"
A: an
A: over
A: hyphenated
A: string
I: plural substring

Note in the example above that four values were returned, not just one. This output is typical of a plural Inspector like ‘substrings’. You can filter this list with a ‘whose’ statement:

Q: (substrings separated by " " of "who observed what happened, when and where?") 
whose (it contains "w")
A: who
A: what
A: when
A: where?
I: plural substring

This example shows two clauses in parentheses. The first parenthetical clause creates a list of words (substrings separated by a space). This ‘whose’ clause contains the primary keyword ‘it’ (discussed in greater detail below), that can stand in for another object – in this case, ‘it’ stands in for each of the individual words, and the expression returns just those words that contain the letter ‘w’. How many of these substrings are there?

Q: number of (substrings separated by " " of "who observed what happened, when 
and where?") 
whose (it contains "w")
A: 4

This expression shows how you can count up the number of items returned and filtered from a plural Inspector. As these examples show, you can get either singular or plural items back from a Relevance expression. What about no items at all? That’s a subject for the next section.