Lessons
Tcl · Easy
Tcl · Easy. Ten lessons. Open-book quizzes. Lesson 1 free.
10 lessons · The Host · Lesson 1 free
Pass all ten lessons for the certificate. Sample · Claim

Lesson 1 · On the house
Lists in depth: lassign, lsort options, lsearch and lset
Unpack lists with lassign, sort by field or a custom rule, find every match with lsearch, and edit lists with lreplace and lset.

Lesson 2
Building and parsing strings: string map, split, join, format and scan
Swap many substrings in one pass with string map, split and join on separators, validate input with string is -strict, and lay out text with format.

Lesson 3
Dicts in depth: nesting, dict update, dict with, filter and map
Build nested dicts with multi-key dict set, edit entries as variables with dict update and dict with, and select or transform entries.

Lesson 4
Regular expressions in depth: -all, -inline, captures and regsub
Count and collect every match, pull out capture groups, find match positions, use lazy quantifiers, and rewrite text with regsub backreferences.

Lesson 5
Procedures in depth: recursion, tailcall, uplevel and return codes
Write recursive procs, use tailcall to keep the stack flat, inspect callers with info level, run code in the caller with uplevel, and raise errors.

Lesson 6
Dates and timing: clock format, clock scan, clock add and time
Turn epoch seconds into dates in any time zone, parse dates with clock scan, do calendar maths with clock add, and benchmark code with time.

Lesson 7
Files and paths: file, append mode, seek and glob
Build portable paths with file join, take them apart, append to files, read a whole file, move with seek and tell, and list folders with glob.

Lesson 8
Running programs: exec, pipes, argv and env
Run other programs with exec, build pipelines, catch failed commands and their exit codes, talk to a process through a pipe, and read script arguments.

Lesson 9
The event loop: after, vwait and after cancel
Schedule code with after, wait for it with vwait, cancel timers, chain repeating tasks, and know when a plain after just sleeps.

Lesson 10
Coroutines: generators with coroutine and yield
Turn a proc into a resumable generator with coroutine and yield, pass a value in on each call, and know when a coroutine ends.
Sample certificate
Certificate of completion
Sign in to claim your certificate of completion.
Certificate
Finish all ten lessons, then sign in
Pass every lesson on this device (quizzes and checks). Then sign in or create an account to type your name and download the JPG.