Values in SenseTalk
Computers deal with a wide variety of data values, including numbers, text, sound, and pictures. The values you will work with the most in SenseTalk are numbers and text. The ability to combine and organize these values in various ways is also important. SenseTalk’s lists and property lists let you do this.
Numbers
Numbers in SenseTalk can be written using numerals:
1
634
12.908
-3
.5
18.75
or as words:
one
six hundred thirty-four
twelve point nine zero eight
negative three
one half
eighteen and three quarters
You can't use commas in numbers to separate groups of digits, because commas have other meanings in SenseTalk, such as separating the items in a list. However, you can use underscores (_) within a number to make a large number more readable (the underscores are simply ignored by SenseTalk). So, the number “one million three hundred thousand” can be written out in words or as 1_300_000 but can’t be written as 1,300,000. (For more information about lists, see lists, below.)
For technical applications, the following notation is also accepted:
- Scientific notation (containing "e+" or "e-" followed by the power of 10)
- Hexadecimal, octal, and binary notation (beginning with "0x", "0o", and "0b").
4.58e+6
0x8ce3
0o377
0b10011010
You can also use unit designations with numbers, such as for length or distance, weight, or angles:
100 yards
5 pounds
12 minutes
For a full discussion of units, see Using Numbers with Units.
Ordinal Numbers
An ordinal number refers to the order or position of something in a sequence. In SenseTalk, ordinal numbers may be used in chunk expressions to refer to a specific chunk of a value.
Ordinal numbers can be expressed as a number followed by an ordinal suffix (st, nd, rd, or th):
1st
, 2nd
, 3rd
, 4th
, 5th
, … , 10th
, … , 31st
, … , 99th
, 100th
, 101st
, 102nd
, … , 2023rd
, …
Ordinal numbers can also be expressed in words:
first
, second
, third
, … , twelfth
, thirteenth
, … , twenty-first
, twenty-second
, … , ninety-ninth
, hundredth
, one hundred first
, ... , two hundredth
, … , nine hundred ninety-ninth
, one thousandth
, one thousand first
, … , millionth
In chunk expressions, ordinals can also be used for counting back from the end of a sequence (note that the dashes are required in these expressions):
second-to-last
, fourth-from-end
, 16th-to-final
Syntax:
{the} ordinal { - [to | from] - [last | end | ultimate | final] }
Text
Text in SenseTalk is usually enclosed in straight double quotation marks:
"abc"
"The Lord of the Rings"
"Greetings, and welcome to the world of computing!"
Full international (Unicode) text is supported. There are a few characters which are hard to represent in quoted text strings, though. In particular, the double quotation mark character itself can’t be used between quotation marks, or the computer would get confused. So SenseTalk provides a special word – quote
– which represents that character. You can use it like this:
"John said " & quote & "Hello!" & quote
The ampersand (&
) concatenates text, joining it together into a single longer string of characters, so the expression shown above would result in the following text:
John said "Hello!"
Another common character which can’t be included directly in quoted text is the return character, used to separate one line of text from the next. The word return
represents the return character in SenseTalk:
"This is line 1." & return & "This is line 2."
Another way of including these characters in text is to use the special double angle bracket pairs <<
and >>
. By using these pairs of characters instead of the double quotation mark, you can include quotation marks and return characters directly:
<<John said "Hello!"
This is line 2. >>