GO-V.ORG
As seen in

SenseTalk

SenseTalk is a high-level English-like scripting language in the XTalk family, that supports both procedural and object-oriented paradigms. SenseTalk scripts are intended to be largely readable by ordinary people, including those with little to no training in programming. To this end, SenseTalk includes a number of language elements that provide functionality oriented towards human tasks rather than the underlying machine behavior. For example, to check whether a quantity is divisible by 3, the script could use the expression or , with the emphasis being on readability and a focus on the human concept of divisibility. Compare this to more traditional programming languages (C, Java, Python... Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.

SenseTalk is a high-level English-like scripting language in the XTalk family, that supports both procedural and object-oriented paradigms. SenseTalk scripts are intended to be largely readable by ordinary people, including those with little to no training in programming. To this end, SenseTalk includes a number of language elements that provide functionality oriented towards human tasks rather than the underlying machine behavior. For example, to check whether a quantity is divisible by 3, the script could use the expression or , with the emphasis being on readability and a focus on the human concept of divisibility. Compare this to more traditional programming languages (C, Java, Python, etc.) where the same test would typically be written as , with the focus being on the machine operations needed to determine the result. This shift in focus away from the underlying machine computation, towards an English-like description of the behavior in human terms leads to the description of SenseTalk as a "people-oriented programming language". Put 12 Into Apples put 5 into Bananas PUT "Total Pieces of Fruit: " & apples+bananas --> displays "Total Pieces of Fruit: 17" This is also true of the names of properties in a property list (SenseTalk's name for a dictionary or hash table). Put {Name:"Green", HexCode:"#00FF00"} into AColor put aColor's name --> displays "Green" put the HEXcode of acolor --> displays "#00FF00" In addition, text operations, including comparisons, searches, and so forth, are case-insensitive by default, although they can be made case-sensitive when needed. Set name to "McMaster" put name contains "master" --> displays True (case is ignored) put name contains "master" considering case --> displays False Put 1 + 2 & 3 + 4 --> displays 37 In this example, the operator has higher priority than the operator, so the expression is equivalent to '(1 + 2) & (3 + 4)' or '3 & 7' giving "37". If parentheses were used to perform the operator first, then '1 + (2 & 3) + 4' would become 1 + "23" + 4 giving a result of 28. Put "Area of a circle with radius 5 is: " & pi * 5 squared Any variable that doesn't have a predefined value, and hasn't yet been explicitly assigned a value, will evaluate either as its own name or as empty depending on the context where it is used. This allows words to be used unquoted in many cases where quotes would otherwise be required. Put CookieCount --> displays "CookieCount" Add 3 dozen to CookieCount --> treated as empty, or 0 put CookieCount --> displays 36 Put 5 yds + 2 ft --> displays 17 feet Variables may contain values with units. The units are carried along with the value and applied in subsequent calculations. Put 5 yds into length add 2 ft to length -- the value in length is converted to a compatible unit to perform the addition put length --> displays 17 feet put 42 inches into width set area to length * width put area --> displays 59.5 square feet More complex units such as velocity (miles per hour, or meters/second) or acceleration (m/s^2) are also supported. Put "8:22" - "8:15" --> displays 420 seconds Date/time values can be stored in variables, and formats are maintained through calculations. Put "March 3" + 34 days --> displays "April 6" Put "2021-03-04" into nextDate Add 4 weeks to nextDate put nextDate --> displays "2021-04-01" Add 4 months to nextDate put nextDate --> displays "2021-08-01" Put characters 7 to 11 of "Rumpelstiltskin" --> displays" stilt" Put the first 3 chars of the second word of "book catalog" --> displays "cat" Chunk expressions can also be used to modify values. In Xtalk language terminology, a chunk of a container (such as a variable) is also a container, so any command that changes the value of a container can also be used to change a chunk. Put "Rumpelstiltskin" into funnyName Put "bump" into characters 7 to 12 of funnyName put funnyName --> displays "Rumpelbumpkin" Put file "/tmp/addressList.txt" into addresses Put "Miriam,219 Sparrow Ln,Freeburgh,MA" & return after addresses Put addresses into file "/tmp/addressList.txt" Because a file is a container, any command that modifies a container can be used directly on a file. Put return & "Earlybird,12 Elm St,Vista,NM" after line 1 of file "/tmp/addressList.txt" Put {type:"ODBC", DSN:"customers", user:"admin", password:"sEcrEt"} into custDB Put table "subscriptions" of custDB into subs -- makes connection to a DB table Add 12 months to expDate of the record of subs where CustNum is "83946-d" -- updates a value in a particular record Set ssnPattern to Patterns can be used in a variety of ways. if userEntry matches ssnPattern then set validSSN to true put every occurrence of ssnPattern in file "userData" into ssnList if clientInfo doesn't contain ssnPattern then put " " after clientInfo The pattern language allows patterns to be built up from other patterns. This example uses the previous ssnPattern to define a pattern that will avoid matching in cases where the immediately preceding or following character is also a digit: set isolatedSSN to ==References== ==External links== SenseTalk - Intuitive Programming SenseTalk Documentation SenseTalk Examples on RosettaCode Keysight Technologies, owners of SenseTalk

source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"SenseTalk". 1762180722. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1320242023

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·