Quality: Very High Level ("What", not "How")


For a People Oriented Programming language to be used by ordinary people without a lot of training in programming techniques, it must be able to accomplish many common tasks at a very high level. This enables the person writing a script to stay focused on what they want the script to do, without getting lost in the myriad details of how to achieve that task.

A Task Oriented Programming language should help users achieve this focus on the "What" rather than the "How" for many common tasks.

In SenseTalk, high level commands and operators often let a script perform an entire task with a single line of code. Here are some examples:

Task: Read the contents of a file into a variable:
put file "HighScores.txt" into scores

Task: Update a file of total scores by adding a current score to the value on the third line of the file:
add currentScore to line 3 of file "HighScores.txt"

Task: Sort the words within a text string:
set animals to "rabbit camel giraffe llama hyena goat"
sort the words of animals
put animals —> "camel giraffe goat hyena llama rabbit"

Task: Sort the numbers within a list:
set numberList to [5,143,2,88,16,42]
sort numberList
put numberList --> [2,5,16,42,88,143]
sort numberList in descending order
put numberList --> [143,88,42,16,5,2]

Task: Sort the lines of a text file on disk with a single command:
sort the lines of file "clients.txt" in descending numeric order by the last item of each

Task: Get a list of every color code used on a web page (of the form "#" followed by 6 hex digits), with a single command:
put every occurrence of <"#" then 6 characters of "0123456789abcdef"> in url "http://www.google.com"
--> ["#c9d7f1","#dd8e27","#551a8b","#767676"]

In this example, the expression url "http://www.google.com" reads the HTML source of the webpage, the expression <"#" then 6 characters of "0123456789abcdef"> is a pattern expression that will match a "#" character that is followed by 6 hexadecimal digits, and every occurrence of finds all of the occurrences of that pattern within the HTML source and returns a list of those values.



Task: Select all of the values from a list of numbers that are multiples of 7:
put each item of [55,32,63,19,49,119,6,21] which is a multiple of 7
--> [63,49,119,21]

Task: Generate a divider using a repeated pattern:
put "-^- " repeated to a length of 30 into divider
put divider
--> -^- -^- -^- -^- -^- -^- -^- -^

Task: Repeat an operation for a period of 2 minutes 30 seconds:
repeat for 2 minutes 30 seconds
  someIterativeProcess
end repeat

Task: Reduce a quantity by another amount, but prevent the result from ever being negative:
set remainder to initialQuantity minus quantityUsed but never less than zero

Task: Select any shapes which are within a target area:
get each item of shapes whose location is within targetArea

Task: Change the terminology used in some text:
replace every occurrence of "matrix" in paragraph with "array"