Tcl have lset command to change value of list’s element.
lset varname index newvalue
Some example of lset on variable named a is presented below.

Lset command can set value of nested list too.
Thats all …
A Computer Person Journey
Tcl have lset command to change value of list’s element.
lset varname index newvalue
Some example of lset on variable named a is presented below.

Lset command can set value of nested list too.
Thats all …
Here is various way to create nested list in tcl. Remember that every thing is a string in Tcl.
% set nestedlist1 { 1 2 { a b c } 3 { d e f } 4 5 }
%set nestedlist2 [list 1 2 [list a b c] 3 [list d e f] 4 5]
%set innerlist1 {a b c}
%set innerlist2 [list d e f]
%set nestedlist3 “1 2 $innerlist1 3 $innerlist2 4 5”
Lindex command can also used to extract an element of nested list.
%lindex $nestedlist1 2 1
b
Try it on tclsh by hand ! Bye …
In Tcl everything is a string. List is also a string. The simplest form of list is a string with zero or more space separated words. Lets set a variable with 3 elements list containing 1,2, and 3.
% set var1 “1 2 3”
% set var2 [list 1 2 3]
% set var3 {1 2 3}
Here we set var1,var2, and var3 to a list, with 3 different way.
To return the number of elements in a list we can use llength command.
% llength $var1
3
To extract an element from list we can use lindex command.
% lindex $var1 1
2
As we can see list has zero based index. The first element is at index 0. Lindex command can accept end and end-? as argument.
% lindex $var1 end
3
% lindex $var1 end-1
2
Thats all for now.
Do you need a Tcl tutorial ? Salvatore write one that we can read online here :
http://www.invece.org/tclwise/
Also check out a n interesting Tcl language implementation here :
http://jim.tcl.tk
The notes application now is more sophisticated : can add note and browse note by note id. Search by keyword still a to do task but its give a lot of experience coding in tcl/tk.
Download source code here

Warning still in progress and still learning how to code tcl/tk.
Extract and execute using wish notes_sqlite3.tcl

Hello world using tcl/tk presented below may be more clear than oneliner before.

Here is the result.

Done.
Creating classic hello world program using GUI in Tcl/Tk can be done in few lines or may be only a line !
Oneliner can do below.
pack [button .b1 -text “Hello World” -command exit -width 50]
This line can be read : pack a button named .b1 with hello world text and exit command when clicked.
Save it to hello_oneline.tcl then run on command prompt : wish hello_oneline.tcl.
Voila!

Click the button and the window will close.
Bye ..
Logging application activity to a log file is a best practice to do by a programmer. Here is how we can do it in Tcl scripting language.

Line 1 to 7 is a proc definition named writelog with a parameter. Parameter will contain message to be written to log file located in d:/applogYYYYMMDD.txt based on current date of clock command. Different day will have a different log file.
Line 9 to 17 is some test to writelog. If we pass hello as parameter to writelog command then “YYYY-MM-DD HH:mm:ss : hello” will be written to log file. Every call to writelog will create new line and put current date time on the beginning of line.
Bye!
To bring tcl/tk programming language and some database connectivity for tcl on OpenBSD do command below as root :
pkg_add tcl tk sqlite3-tcl pgtcl
OpenBSD 6.6 can install tcl/tk 8.5 and 8.6.
Two extra package named sqlite3-tcl and pgtcl will give tcl capability to work with sqlite3 database and postgresql database.
Tdbc also a good choice for database connectivity. Tdbc packages on OpenBSD available for mysql, postgres, sqlite3. To add tdbc , we can do pkg_add tdbc-postgres tdbc-mysql tdbc-sqlite3.
Later will write more about tcl/tk.