Real name Mark Janssen (Tcl Chatroom nick: mjanssen). I have been using Tcl since 2004 and I love it.
There are several reasons I love Tcl:
Current projects
Pages I contributed to
Random ideas I like to pursue
TODO
Autoexpansion of leading word
I have created a Tcl git repo with changes needed to have auto-expansion of a leading word at [L3 ]. This allows data structures like TOOT with {*}. To demonstrate that example:
% set m {matrix {{1 2 3}
{4 5 6}
{7 8 9}}
}
% proc matrix {matrix {method {}} args} {
if {$method eq {}} {
# return the 'typeless' matrix
return $matrix
}
switch $method {
row {
return [lindex $matrix [lindex $args 0]]
}
}
}
% $m ; #gives the undecorated matrix
{1 2 3}
{4 5 6}
{7 8 9}
% $m row 1
4 5 6
Which is a thing of beauty IMO.
The git repo linked to is dead, but the change to enable autoexpansion seems to be almost trivial.
--- generic/tclParse.c
+++ generic/tclParse.c
@@ -301,11 +301,11 @@
parsePtr->commandStart = src;
type = CHAR_TYPE(*src);
scanned = 1; /* Can't have missing whitepsace before first word. */
while (1) {
- int expandWord = 0;
+ int expandWord = (parsePtr->numWords==0);
/* Are we at command termination? */
if ((numBytes == 0) || (type & terminators) != 0) {
parsePtr->term = src;
Everything I post on the wiki is in the public domain unless explicitly marked otherwise. I would love to hear if some of it was useful to you though.