Commands
Each command of ztcl has a page: its synopsis, what it gives, its options and subcommands, examples that run in the shell of the page, its errors, the capability that it needs, and how it differs from Tcl 8.6. A command with a capability has its name in a tag: a new interpreter does not have it until the host turns the capability on.
For agents, api.json has the same facts for each command, and llms-full.txt has the Markdown of each page.
No command matches.
Strings
stringThe commands for text: length, search, compare, change, and test.tcl::prefixMatches a word to a unique prefix of a table, as a command does with its options.appendAdds each value to the end of the string in the variable, and gives the new value.concatJoins the arguments with one space, after it removes the white space at the ends of each one.formatMakes a string from a template, asprintfof C does.scanReads values from a string with a template offormat.splitMakes a list: it cuts the string at each character of splitChars (white space by default).joinMakes a string of the elements of a list, with joinString (one space by default) between them.regexpFinds the regular expression exp in string.regsubReplaces the matches of exp in string with subSpec, and gives the new string.substDoes the substitutions of Tcl on a string:$name,[script], and backslashes.encodingchannels Changes text to bytes and back.binaryPacks values into bytes and reads values from bytes, with a template of letters such asc(8 bits),s(16 bits, little endian),S(big endian),iandI(32 bits),wandW(64 bits),fandd(floats),a(bytes), andH(hexadecimal).tcl_endOfWordThe index after the end of the first word that ends after start, or -1.
Lists
foreachRuns a script for each element of one or more lists.lappendAdds values as elements to the end of the list in a variable.lassignPuts the elements of a list in variables, and gives the elements that are left.leditReplaces a range of elements of the list in a variable.lfilterGives the elements of a list for which a script gives true.lindexGives the element of a list at an index, or at a path of indexes into nested lists.linsertGives a list with elements put in before an index.listMakes a list with each argument as one element.llengthGives the count of elements of a list.lmapRuns a script for each element of one or more lists, and gives a list of the results.lpopRemoves an element from the list in a variable and gives it.lrangeGives the elements of a list from one index to another, as a list.lremoveGives a list with the elements at some indexes removed.lrepeatMakes a list with the same elements repeated a number of times.lreplaceGives a list with a range of elements replaced by new elements.lreverseGives the elements of a list in the reverse order.lsearchFinds the elements of a list that match a pattern.lseqMakes a list of numbers in an arithmetic series.lsetSets one element of the list in a variable, also in nested lists.lsortGives a sorted copy of a list.
Dicts and arrays
Math
exprComputes an expression with the operators of C and the math functions.incrAdds increment (1 by default) to the integer in a variable, and gives the new value.tcl::mathfuncThe functions ofexpr, each one also a command in this namespace.tcl::mathfunc::truncThe math functions of Tcl 9.1: the functions of C99acosh,asinh,atanh,cbrt,copysign,dim(fdim of C),erf,erfc,exp2,expm1,fma,gamma(tgamma of C),ldexp,lgamma,log1p,log2,logb,nextafter,remainder, andtrunc, and the testsisfinite,isinf,isnan,isnormal,issubnormal,isunordered, andsignbit.tcl::mathop::ltThe string order operators of Tcl 9.1:lt,gt,le, andge.divmodThe quotient and the remainder of two integers of any size, as a list.fpclassifyThe class of a number:zero,subnormal,normal,infinite, ornan.frexpThe fraction and the exponent of a double, as a list.modfThe integer part and the fraction part of a double, as a list.remquoThe remainder ofremainder()and the low 3 bits of the rounded quotient with the sign of the quotient, as a list.tcl::mathopEach operator ofexpras a command:+,-,*,/,%,**,<<,>>,&,|,^,~,!,==,!=,<,<=,>,>=,eq,ne,in, andni.noise3Smooth noise of three coordinates, a float from -1 to 1, for shapes and textures.
Variables
setWith a value, sets the variable and gives the value.unsetRemoves variables.globalIn a proc, links each name to the variable of the same name at the top level.variableIn a namespace, makes namespace variables and gives them values.upvarLinks a local name to a variable of a caller.traceRuns a command when a variable is read, written, or unset, or when a command is renamed, deleted, or run.
Control flow
ifRuns the body of the first condition that is true.whileRuns the command while the test, anexprexpression, is true.forRuns start once, then the command and next while the test is true, as theforof C.breakStops the loop that runs it:while,for,foreach,lmap, ordict for.continueGoes on with the next pass of the loop that runs it.switchRuns the body of the first pattern that matches the string.caseThe old form ofswitch -glob.evalJoins its arguments asconcatdoes and runs the result as a script.uplevelRuns a script in the scope of a caller:1(the default) is the caller, and#0is the top level.applyRuns a lambda: a list of the arguments and a body, with an optional namespace.timeclock Runs the command count times (1 by default) and gives the mean time of one run in microseconds.timerateclock Runs the command for a time (1,000 ms by default) and gives the time of one run, the count of runs, and the rate.
Procs and namespaces
procMakes a command from a body of Tcl.returnEnds the proc and gives the value as its result.tailcallEnds the proc and runs the command in its place, so that the stack does not grow.renameGives a command a new name.namespaceThe commands for namespaces: groups of commands and variables with a name.unknownThe command that runs for a command name that does not exist.coroutineMakes a command name and runs cmd until its firstyield.yieldStops the coroutine that runs it and gives the value to the caller.yieldtoStops the coroutine and runs the command in the place of the caller.coroinjectPuts a command in a suspended coroutine.coroprobeRuns a command now in a suspended coroutine, in the place where it waits, and gives its result.tcl::unsupported::injectPuts a command in a suspended coroutine.tcl::unsupported::corotypeHow a coroutine waits:yieldoryieldto, oractivewhile it runs.walkA command of the runner of ztcl for its own tests.
Errors
Files and channels
chanchannels The commands for channels: read, write, move, configure, and copy.filefile The commands for paths and files: names, tests, facts, and changes.openchannels Opens a file and gives a channel name.closechannels Writes what is left in the buffer and closes the channel.getschannels Reads one line with no newline.readchannels Reads numChars characters, or all of the input to its end.putsWrites the string and a newline.flushchannels Writes the buffer of the channel now.eofchannels 1 after a read reached the end of the input.seekchannels Moves the place of the next read or write.tellchannels The place of the next read or write, in bytes from the start.fconfigurechannels Gives or sets the options of a channel:-blocking,-buffering(full,line, ornone),-buffersize,-encoding(utf-8,binary,ascii,unicode, or an encoding file ofencoding dirs),-translation(auto,lf,crlf, orbinary), and-eofchar.fblockedchannels 1 when the last read of a channel that does not block had no full line.fcopychannels Copies from one channel to another.sourcechannels Runs the script in a file, and gives the result of its last command.globfile The names of the files that match glob patterns.cdfile Changes the working folder, inside the root folder of the interpreter.pwdfile The working folder.zipfsfile The zip file systems under//zipfs:/.socketsocket Opens a TCP connection and gives a channel, or with-servermakes a server that calls the command with a channel, an address, and a port for each new connection.
Events
afterevent With a script, runs it from the event loop after ms milliseconds and gives an id.vwaitevent Runs the event loop until the variable is set.updateevent Runs each event that is ready, and returns.fileeventevent Runs the script from the event loop when the channel isreadableorwritable.tcl::Bgerrorevent The default handler of an error in a script that the event loop runs.
Interpreters and packages
interpinterp Makes and runs child interpreters.packageLoads packages by name and version.safe::interpCreatepackage The safe package 0.10 of the Tcl library (the Safe Base), which loads at the first call of one of its commands: a safe child with aliases into the parent forsource,load,glob,encoding,exit,clock, and thefilesubcommands that read no file.tclPkgUnknownpackage The handler ofpackage unknown: sources thepkgIndex.tclfile of each folder ofauto_pathand of each folder in it, once.tcl::tm::pathpackage The module path of Tcl modules.pkg_mkIndexpackage Writes thepkgIndex.tclfile of a folder, as Tcl does.auto_mkindexpackage Writes thetclIndexfile of a folder forauto_load, as Tcl does.auto_loadpackage Defines a command fromauto_index, which thetclIndexfiles ofauto_pathandtclPkgSetup(the lazypkgIndex.tclform) fill.historypackage The list of the commands of a session, as in Tcl:add,change,clear,event,info,keep,nextid, andredo.
Objects
oo::classMakes a class.oo::defineChanges the definition of a class.oo::objdefineChanges the definition of one object, with the words ofoo::defineandclassto change its class.oo::copyMakes a new object with the class, the methods, and the variables of an object.myIn a method, calls a method of the same object, also one that is not exported.selfIn a method, gives facts about the call:selforself objectis the name of the object,self classthe class of the method,self methodthe name of the method, andself nextthe next method of the chain.nextIn a method, calls the method of the same name of the next class of the chain, such as the parent class, and gives its result.
Threads
The system
infoFacts about the interpreter: its commands, procs, variables, and the call stack.clockclock The time.httppackage The http package 2.9.8 of the Tcl library, withpackage require http: an HTTP/1.1 client on the sockets of ztcl.tcl::OptProcpackage The opt package 0.4.9 of the Tcl library, withpackage require opt: a proc whose words are checked against a description of flags and parameters.platform::genericpackage The platform package 1.0.19 of the Tcl library, withpackage require platform: the system and the CPU as one identifier OS-CPU, such aslinux-x86_64ormacosx-arm, fromtcl_platform.msgcatclock Message catalogs for text in more than one language, as the msgcat package 1.6.1 of Tcl.execexec Runs a program and gives its output.pidexec The process id of the program, or of the processes of a pipeline.exitEnds the program with the code (0 by default).
ztcl modules
ztcl::jsonJSON: parse to Tcl values, read one value with no full parse, check, and write with a schema.ztcl::vtA terminal screen in memory: feed it the bytes of a program, and read its cells and its text.ztcl::wasmRuns WebAssembly modules in the sandbox and the limits of the interpreter: decodes and validates a module, links its imports to Tcl commands, other instances, or WASI preview 1, and calls its exports with Tcl values.ztcl::textCuts a string into grapheme clusters, words, or sentences by the rules of Unicode 18.0.0 (UAX #29), and gives its display width in columns (UAX #11 and UTS #51).ztcl::probeRecords the values of a running script at a proc, a line, a command, a variable, or an error, with no change to the script, and gives the records back as dicts or JSON.ztcl::tlssocket A TLS 1.3 client: connects tohostonport, runs the handshake, checks the certificate chain and the host name, and gives a channel.ztcl::ptyexec Runs a program in a pseudo terminal, forztcl::vtand for tests of terminal apps.ztcl::watchfile Runs a script when a file or a folder changes.ztcl::openlaunch Opens a URL or a file in the default app of the host.ztcl::notifynotify Shows a notification of the system.ztcl::gcmeter Gives the counts of the collector of the heap of the interpreter tree: the pauses, the time of the marks and the sweeps, the bytes of the heap, the bytes that the program allocated, and the resident set of the process.ztcl::metermeter Counts the compute units, the time, the memory, and the I/O of threads and child interpreters, for a host that bills its customers.ztcl::agentthread Runs an LLM agent loop in an isolated thread with no capability, which holds only the data and the tools that the host gives it.ztcl::pdfMakes a PDF document: pages, text in embedded TrueType fonts, rectangles, lines, images, links, named places, the outline, and the document information.ztcl::typesetBreaks paragraphs into lines with the total-fit algorithm of Knuth and Plass, hyphenates words with the patterns of Liang, measures text in TrueType fonts, and lays out Markdown into the pages of a PDF document.