scratch

Difference between version 13 and 14 - Previous - Next
[gold] Replay old scratch page on TCL Wiki. checking end of line issues here. 

 

Not a Replacement for TCL Core
This page on developing pseudocode examples and one line procedures is not a replacement for the current Tcl core and Tcllib, which is much improved since Tcl version 4, and other <faster> language constructs. math ops, Tcllib routines, and other compiled routines can reduce the cost of big-data tasks by about 1/3. The time savings of the core are not always obvious on small quantities of data, like 4 or 5 numbers. Performance of one-line programs may suffer degradation due to lengthy recursion calls, and may be limited by constraints on recursion. Dependence on math operator notation, helper procedures, math check examples, degradation due to lengthy recursion calls, and special library functions should be noted in the comment lines.

what is the difference between curly braces and double quotes for tcl commands


Title: the difference and useage between double quotes (" ") and Braces { }  in tool control language TCL?

In Tcl (Tool Command Language), both double quotes (" ") and curly braces ({ }) serve distinct purposes. Lets delve into their differences and usage:

Double Quotes (" "):
Double quotes allow interpolation to occur within the group.
When you enclose text in double quotes, Tcl will substitute variables, commands, and backslashes within the quoted string.
For example:

 

In TCL (Tool Command Language), double quotes (" ") are used to enclose strings whereas braces { } are used for grouping command words together.

When using double quotes, the contents inside the quotes are treated as a single string. This means that any special characters or variables inside the quotes will be interpreted as part of the string and not as separate entities.

For example:

 
set name "John"
puts "Hello $name"
In the above example, the variable $name will be evaluated inside the double quotes and the output will be "Hello John".

On the other hand, braces are used for grouping command words together. This means that the contents inside braces are treated as a single word, and any special characters or variables inside the braces will not be evaluated.

For example:

 
set num {1 + 2}
expr $num
In the above example, the expression inside the braces {1 + 2} will not be evaluated as a mathematical expression. Instead, it will be treated as a single word and the output will be "1 + 2".

In summary, the main difference between double quotes and braces in TCL is that double quotes are used to create strings while braces are used for grouping command words together. Double quotes allow for variable interpolation and special character interpretation, while braces do not.

======
# list from copy of [Tcllib] deck on jdoodle.
puts " list of twin primes = [ listPrimePairs 3 100 2 ] "
list of twin primes = {3 5} {5 7} {11 13} {17 19} {29 31} {41 43} {59 61} {71 73}
======
----
----
*** Testing Mill's Constant for Primes***
----
======
# Power formula produces a prime number from Mill's Constant
global theta
set theta 1.3063778838630806904686144926
proc mills_constant_tester {limit} { global theta;
expr {  int( [ expr {($theta**(3**$limit))} ] )}}
puts " mills_constant [ mills_constant_tester 1 ]      "
puts " mills_constant [ mills_constant_tester 2 ]     "
puts " mills_constant [ mills_constant_tester 3 ]   "
puts " mills_constant [ mills_constant_tester 4 ]   "
# mills_constant 2      
# mills_constant 11     
# mills_constant 1361   
# mills_constant 2521008886
# big numbers evaled and large significant figures in constant, results limited quickly in most setups. 
====== 
----
Note. Power formula produces a prime number from Mill's Constant. Big numbers are evaled here and large significant figures in constant. Results are limited quickly in most setups. 
----
Note. Condition that N>10, primes end in either 1,3,5,7 for base 10? In base 10, prime numbers end in either 1, 3, 7, or 9. The last digit of a prime number cannot be 0, 2, 4, 6, or 8 because those numbers are all divisible by 2. The last digit cannot be 5 because that would make the number divisible by 5. This leaves us with the last digits 1, 3, 7, and 9.
--------
#----
 
**Hidden Comments Section**

<<discussion>>
Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Thanks, [gold] 12Sep2021 
a

----
<<discussion>> Hidden Comments Section 
----

----
<<discussion>>  test for hidden comments stop
----
test! seems to work
----
<<discussion>>  Hidden Change Log  Section 
----
[gold] 9/11/2021. first edit
----
[gold] 9/12/2021. replaced original proc 
----
[gold] 9/13/2021. added  formulas, replaced :# with #.
---- 
[gold] 9/13/2021. & negative logic test for integers.                                              
----
<<categories>> Numerical Analysis | Toys | Calculator | Mathematics| Example| Toys and Games | Games | Application | GUI
----
<<categories>> Development | Concept| Algorithm  | Biology