Local Attractions
While travelling in the land of sensetalk be sure not to miss out on the special features and local attractions!
SenseTalk includes a number of higher-level features that set it apart from other languages and contribute to its "people oriented" nature. Some are intrinsic to the fundamentals of the language, and some are specific features. We'll describe a few of them here.
Units
Numeric values may have units associated with them. SenseTalk understands hundreds of different units and is able to perform calculations with them and conversions to related units.
put 5 ft into length
put 20 inches into width
set area to length * width
put area --> 8.333333 square feet
put area as cm^2 --> 7741.92 square centimeters
Patterns
SenseTalk's pattern language was touched on elsewhere, but is worth mentioning again. It provides all of the functionality of regular expressions, but in a highly readable (and writable) form.
put every occurrence of <digit> in "pi is 3.14 or 22/7" --> ["3","1","4","2","2","7"]
Each Expressions
Each expressions are a powerful, expressive tool for processing lists or chunks. They are similar to "list comprehensions" in Python or other languages.
put each word of "in a hole in the ground" whose length is more than 3 --> ["hole","ground"]
Files as Containers
SenseTalk allows you to treat a text file as a "container". This lets you perform any text operations on a file that you could perform on a variable or other container, including accessing, setting, or modifying its value.
put "once upon a time" into file "tale.txt"--> set file contents
put the last word of file "tale.txt" --> "time"
set the first word of file "tale.txt" to capitalized of word 1 of file "tale.txt"
put "…" after file "tale.txt"
put file "tale.txt" --> "Once upon a time…"
Database Access
SenseTalk's built-in support for working with SQL databases lets you fetch and update records in a direct and highly readable way.
This two-line example establishes a connection to the database server, fetches a specific record from one of the database tables, updates one of the values in that record and writes the updated record back to the table.
set customerTable to table "Cust" of database {type:"odbc", dsn:"abc", name:"Ajax"}
add 1 year to the expDate of the record of customerTable where custNum is "30194"
Dates and Times
SenseTalk has extensive facilities for working with date and time values .
put "March 29" + 10 days —> "April 8"
put ("Apr 8, 2021" - "2021-03-29") as days —> 10 days
Multiple Inheritance
SenseTalk objects can have multiple helpers, whose behaviors supplement that of the object. An object may even have 'early helpers' whose behavior will override that of the object itself.
And More
The adventurous among you may also want to explore some of these topics:
- Format property of variables (number formats, date formats)
- Advanced Operators (
but at least
,is a multiple of
, repeated to length, vector arithmetic, multiple assignment, add-on percent) - Iterators
- Sockets, URL, HTTP and XML-RPC, XML, CSV support
- References to containers (more than just pass-by-reference)