Skip to main content
Mod Removes Wiki by Doorknob
deleted 62 characters in body
Source Link
  1. Use rename to rename rename:

    rename rename &
    

    The & can be any identifier; & just reminds me of "references" in C.

  2. Use the renamed rename to rename set:

    & set =
    

    Again, the = can be any identifier; = is just intuitive to me.

  3. Now, rename other commands that are worth renaming, e.g.

    & regsub R
    & string S
    & while W
    

    A command is worth renaming if, given its length n, and occurrences k, k(n-1)-(n+4) > 0. Solving for k, the formula becomes k > (n+4)/(n-1). Here's a reference table that makes it easy:

    length of       minimum         example(s)
    command         occurrences
    ------------------------------------------------
    2               6               if (consider renaming to "?")
    3               4               for, set (consider renaming to "=")
    4               3               eval, expr, incr (consider renaming to "+"), info, join, proc, puts, scan
    5               3               break, catch, lsort, split, subst, trace, unset, while
    6               3               format, lindex, lrange, regexp, regsub, rename, return, string, switch
    7               2               foreach, lappend, linsert, llength, lsearch, unknown
    .               2               lreplace
    .               2               continue
    .               2               
    
  4. Next, compact frequently used subcommands like

    = I index
    = L length
    

    so you can do things like

    S $I $x 7
    S $L $x
    
  5. Some obvious miscellanea:

    1. Consider using the ternary operator ? to compact multiple ifs.
    2. lappend can set the first element of a list if it doesn't yet exist (no need to initialize).
    3. You can set arrays without using array, e.g. set doesNotExist(7) 43.
    4. You can use strings ("a b c") instead of [list a b c].
    5. You can interpolate in strings like so: foo${a}bar.
    6. You can use two\ words rather than "two words". (Remember in general that for contiguous strings without spaces, double quotes can be omitted!)
    7. You can almost always rewrite fors as whiles to save a character or two, since a while can simultaneously check and increment while a for uses separate blocks.
  6. For larger programs, here's a trick I thought of but neverhaven't yet applied:

    proc unknown {c args} {eval [info commands $c*] $args}
    

    This emulates interactive command abbreviations! It costs 54 characters, but now you can use j for join, sp for split, st for string, w for while, and so on.

  1. Use rename to rename rename:

    rename rename &
    

    The & can be any identifier; & just reminds me of "references" in C.

  2. Use the renamed rename to rename set:

    & set =
    

    Again, the = can be any identifier; = is just intuitive to me.

  3. Now, rename other commands that are worth renaming, e.g.

    & regsub R
    & string S
    & while W
    

    A command is worth renaming if, given its length n, and occurrences k, k(n-1)-(n+4) > 0. Solving for k, the formula becomes k > (n+4)/(n-1). Here's a reference table that makes it easy:

    length of       minimum         example(s)
    command         occurrences
    ------------------------------------------------
    2               6               if (consider renaming to "?")
    3               4               for, set (consider renaming to "=")
    4               3               eval, expr, incr (consider renaming to "+"), info, join, proc, puts, scan
    5               3               break, catch, lsort, split, subst, trace, unset, while
    6               3               format, lindex, lrange, regexp, regsub, rename, return, string, switch
    7               2               foreach, lappend, linsert, llength, lsearch, unknown
    .               2               lreplace
    .               2               continue
    .               2               
    
  4. Next, compact frequently used subcommands like

    = I index
    = L length
    

    so you can do things like

    S $I $x 7
    S $L $x
    
  5. Some obvious miscellanea:

    1. Consider using the ternary operator ? to compact multiple ifs.
    2. lappend can set the first element of a list if it doesn't yet exist (no need to initialize).
    3. You can set arrays without using array, e.g. set doesNotExist(7) 43.
    4. You can use strings ("a b c") instead of [list a b c].
    5. You can interpolate in strings like so: foo${a}bar.
    6. You can use two\ words rather than "two words". (Remember in general that for contiguous strings without spaces, double quotes can be omitted!)
    7. You can almost rewrite fors as whiles to save a character or two, since a while can simultaneously check and increment while a for uses separate blocks.
  6. For larger programs, here's a trick I thought of but never applied:

    proc unknown {c args} {eval [info commands $c*] $args}
    

    This emulates interactive command abbreviations! It costs 54 characters, but now you can use j for join, sp for split, st for string, w for while, and so on.

  1. Use rename to rename rename:

    rename rename &
    

    The & can be any identifier; & just reminds me of "references" in C.

  2. Use the renamed rename to rename set:

    & set =
    

    Again, the = can be any identifier; = is just intuitive to me.

  3. Now, rename other commands that are worth renaming, e.g.

    & regsub R
    & string S
    & while W
    

    A command is worth renaming if, given its length n, and occurrences k, k(n-1)-(n+4) > 0. Solving for k, the formula becomes k > (n+4)/(n-1). Here's a reference table that makes it easy:

    length of       minimum         example(s)
    command         occurrences
    ------------------------------------------------
    2               6               if (consider renaming to "?")
    3               4               for, set (consider renaming to "=")
    4               3               eval, expr, incr (consider renaming to "+"), info, join, proc, puts, scan
    5               3               break, catch, lsort, split, subst, trace, unset, while
    6               3               format, lindex, lrange, regexp, regsub, rename, return, string, switch
    7               2               foreach, lappend, linsert, llength, lsearch, unknown
    .               2               lreplace
    .               2               continue
    .               2               
    
  4. Next, compact frequently used subcommands like

    = I index
    = L length
    

    so you can do things like

    S $I $x 7
    S $L $x
    
  5. Some obvious miscellanea:

    1. lappend can set the first element of a list if it doesn't yet exist (no need to initialize).
    2. You can set arrays without using array, e.g. set doesNotExist(7) 43.
    3. You can use strings ("a b c") instead of [list a b c].
    4. You can interpolate in strings like so: foo${a}bar.
    5. You can use two\ words rather than "two words". (Remember in general that for contiguous strings without spaces, double quotes can be omitted!)
    6. You can almost always rewrite fors as whiles to save a character or two, since a while can simultaneously check and increment while a for uses separate blocks.
  6. For larger programs, here's a trick I thought of but haven't yet applied:

    proc unknown {c args} {eval [info commands $c*] $args}
    

    This emulates interactive command abbreviations! It costs 54 characters, but now you can use j for join, sp for split, st for string, w for while, and so on.

added 322 characters in body
Source Link
  1. Use rename to rename rename:

    rename rename &
    

    The & can be any identifier; & just reminds me of "references" in C.

  2. Use the renamed rename to rename set:

    & set =
    

    Again, the = can be any identifier; = is just intuitive to me.

  3. Now, rename other commands that are worth renaming, e.g.

    & regsub R
    & string S
    & while W
    

    A command is worth renaming if, given its length n, and occurrences k, k(n-1)-(n+4) > 0. Solving for k, the formula becomes k > (n+4)/(n-1). Here's a reference table that makes it easy:

    length of       minimum         example(s)
    command         occurrences
    ------------------------------------------------
    2               6               if (consider renaming to "?")
    3               4               for, set (consider renaming to "=")
    4               3               eval, expr, incr (consider renaming to "+"), info, join, proc, puts, scan
    5               3               break, catch, lsort, split, subst, trace, unset, while
    6               3               format, lindex, lrange, regexp, regsub, rename, return, string, switch
    7               2               foreach, lappend, linsert, llength, lsearch, unknown
    .               2               lreplace
    .               2               continue
    .               2               
    
  4. Next, compact frequently used subcommands like

    = I index
    = L length
    

    so you can do things like

    S $I $x 7
    S $L $x
    
  5. Some obvious miscellanea:

    1. Consider using the ternary operator ? to compact multiple ifs.
    2. lappend can set the first element of a list if it doesn't yet exist (no need to initialize).
    3. You can set arrays without using array, e.g. set doesNotExist(7) 43.
    4. You can use strings ("a b c") instead of [list a b c].
    5. You can interpolate in strings like so: foo${a}bar.
    6. You can use two\ words rather than "two words". (Remember in general that for contiguous strings without spaces, double quotes can be omitted!)
    7. You can almost rewrite fors as whiles to save a character or two, since a while can simultaneously check and increment while a for uses separate blocks.
  6. For larger programs, here's a trick I thought of but never applied:

    proc unknown {c args} {eval [info commands $c*] $args}
    

    This emulates interactive command abbreviations! It costs 54 characters, but now you can use j for join, sp for split, st for string, w for while, and so on.

  1. Use rename to rename rename:

    rename rename &
    

    The & can be any identifier; & just reminds me of "references" in C.

  2. Use the renamed rename to rename set:

    & set =
    

    Again, the = can be any identifier; = is just intuitive to me.

  3. Now, rename other commands that are worth renaming, e.g.

    & regsub R
    & string S
    & while W
    

    A command is worth renaming if, given its length n, and occurrences k, k(n-1)-(n+4) > 0. Solving for k, the formula becomes k > (n+4)/(n-1). Here's a reference table that makes it easy:

    length of       minimum         example(s)
    command         occurrences
    ------------------------------------------------
    2               6               if (consider renaming to "?")
    3               4               for, set (consider renaming to "=")
    4               3               eval, expr, incr (consider renaming to "+"), info, join, proc, puts, scan
    5               3               break, catch, lsort, split, subst, trace, unset, while
    6               3               format, lindex, lrange, regexp, regsub, rename, return, string, switch
    7               2               foreach, lappend, linsert, llength, lsearch, unknown
    .               2               lreplace
    .               2               continue
    .               2               
    
  4. Next, compact frequently used subcommands like

    = I index
    = L length
    

    so you can do things like

    S $I $x 7
    S $L $x
    
  5. Some obvious miscellanea:

    1. Consider using the ternary operator ? to compact multiple ifs.
    2. lappend can set the first element of a list if it doesn't yet exist (no need to initialize).
    3. You can set arrays without using array, e.g. set doesNotExist(7) 43.
    4. You can use strings ("a b c") instead of [list a b c].
    5. You can interpolate in strings like so: foo${a}bar.
    6. You can use two\ words rather than "two words". (Remember in general that for contiguous strings without spaces, double quotes can be omitted!)
    7. You can almost rewrite fors as whiles to save a character or two, since a while can simultaneously check and increment while a for uses separate blocks.
  1. Use rename to rename rename:

    rename rename &
    

    The & can be any identifier; & just reminds me of "references" in C.

  2. Use the renamed rename to rename set:

    & set =
    

    Again, the = can be any identifier; = is just intuitive to me.

  3. Now, rename other commands that are worth renaming, e.g.

    & regsub R
    & string S
    & while W
    

    A command is worth renaming if, given its length n, and occurrences k, k(n-1)-(n+4) > 0. Solving for k, the formula becomes k > (n+4)/(n-1). Here's a reference table that makes it easy:

    length of       minimum         example(s)
    command         occurrences
    ------------------------------------------------
    2               6               if (consider renaming to "?")
    3               4               for, set (consider renaming to "=")
    4               3               eval, expr, incr (consider renaming to "+"), info, join, proc, puts, scan
    5               3               break, catch, lsort, split, subst, trace, unset, while
    6               3               format, lindex, lrange, regexp, regsub, rename, return, string, switch
    7               2               foreach, lappend, linsert, llength, lsearch, unknown
    .               2               lreplace
    .               2               continue
    .               2               
    
  4. Next, compact frequently used subcommands like

    = I index
    = L length
    

    so you can do things like

    S $I $x 7
    S $L $x
    
  5. Some obvious miscellanea:

    1. Consider using the ternary operator ? to compact multiple ifs.
    2. lappend can set the first element of a list if it doesn't yet exist (no need to initialize).
    3. You can set arrays without using array, e.g. set doesNotExist(7) 43.
    4. You can use strings ("a b c") instead of [list a b c].
    5. You can interpolate in strings like so: foo${a}bar.
    6. You can use two\ words rather than "two words". (Remember in general that for contiguous strings without spaces, double quotes can be omitted!)
    7. You can almost rewrite fors as whiles to save a character or two, since a while can simultaneously check and increment while a for uses separate blocks.
  6. For larger programs, here's a trick I thought of but never applied:

    proc unknown {c args} {eval [info commands $c*] $args}
    

    This emulates interactive command abbreviations! It costs 54 characters, but now you can use j for join, sp for split, st for string, w for while, and so on.

Rollback to Revision 1
Source Link
  1. Use rename to rename rename:

    rename rename &
    

    The & can be any identifier; & just reminds me of "references" in C.

  2. Use the renamed rename to rename set:

    & set =
    

    Again, the = can be any identifier; = is just intuitive to me.

  3. Now, rename other commands that are worth renaming, e.g.

    & regsub R
    & string S
    & while W
    

    A command is worth renaming if, given its length n, and occurrences k, k(n-1)-(n+4) > 0. Solving for k, the formula becomes k > (n+4)/(n-1). Here's a reference table that makes it easy:

    length of       minimum         example(s)
    command         occurrences
    ------------------------------------------------
    2               6               if (consider renaming to "?")
    3               4               for, set (consider renaming to "=")
    4               3               eval, expr, incr (consider renaming to "+"), info, join, proc, puts, scan
    5               3               break, catch, lsort, split, subst, trace, unset, while
    6               3               format, lindex, lrange, regexp, regsub, rename, return, string, switch
    7               2               foreach, lappend, linsert, llength, lsearch, unknown
    .               2               lreplace
    .               2               continue
    .               2               
    
  4. Next, compact frequently used subcommands like

    = I index
    = L length
    

    so you can do things like

    S $I $x 7
    S $L $x
    
  5. Some (obvious)obvious miscellanea:

    1. Consider using the ternary operator ? to compact multiple ifs.
    2. lappend can set the first element of a list if it doesn't yet exist (no need to initialize).
    3. You can set arrays without using array, e.g. set doesNotExist(7) 43.
    4. You can use strings ("a b c") instead of [list a b c].
    5. You can interpolate in strings like so: foo${a}bar.
    6. You can use two\ words rather than "two words". (Remember in general that for contiguous strings without spaces, double quotes can be omitted!)
    7. You can almost rewrite fors as whiles to save a character or two, since a while can simultaneously check and increment while a for uses separate blocks.
    8. Consider using incr to add instead of expr, e.g. incr $i $j instead of expr $i+$j. Why, if they're the same length? Because you're likely to have more incrs than exprs in your program, so unless you're renaming both, this way you'll benefit from using a renamed incr.
  1. Use rename to rename rename:

    rename rename &
    

    The & can be any identifier; & just reminds me of "references" in C.

  2. Use the renamed rename to rename set:

    & set =
    

    Again, the = can be any identifier; = is just intuitive to me.

  3. Now, rename other commands that are worth renaming, e.g.

    & regsub R
    & string S
    & while W
    

    A command is worth renaming if, given its length n, and occurrences k, k(n-1)-(n+4) > 0. Solving for k, the formula becomes k > (n+4)/(n-1). Here's a reference table that makes it easy:

    length of       minimum         example(s)
    command         occurrences
    ------------------------------------------------
    2               6               if (consider renaming to "?")
    3               4               for, set (consider renaming to "=")
    4               3               eval, expr, incr (consider renaming to "+"), info, join, proc, puts, scan
    5               3               break, catch, lsort, split, subst, trace, unset, while
    6               3               format, lindex, lrange, regexp, regsub, rename, return, string, switch
    7               2               foreach, lappend, linsert, llength, lsearch, unknown
    .               2               lreplace
    .               2               continue
    .               2               
    
  4. Next, compact frequently used subcommands like

    = I index
    = L length
    

    so you can do things like

    S $I $x 7
    S $L $x
    
  5. Some (obvious) miscellanea:

    1. Consider using the ternary operator ? to compact multiple ifs.
    2. lappend can set the first element of a list if it doesn't yet exist (no need to initialize).
    3. You can set arrays without using array, e.g. set doesNotExist(7) 43.
    4. You can use strings ("a b c") instead of [list a b c].
    5. You can interpolate in strings like so: foo${a}bar.
    6. You can use two\ words rather than "two words". (Remember in general that for contiguous strings without spaces, double quotes can be omitted!)
    7. You can almost rewrite fors as whiles to save a character or two, since a while can simultaneously check and increment while a for uses separate blocks.
    8. Consider using incr to add instead of expr, e.g. incr $i $j instead of expr $i+$j. Why, if they're the same length? Because you're likely to have more incrs than exprs in your program, so unless you're renaming both, this way you'll benefit from using a renamed incr.
  1. Use rename to rename rename:

    rename rename &
    

    The & can be any identifier; & just reminds me of "references" in C.

  2. Use the renamed rename to rename set:

    & set =
    

    Again, the = can be any identifier; = is just intuitive to me.

  3. Now, rename other commands that are worth renaming, e.g.

    & regsub R
    & string S
    & while W
    

    A command is worth renaming if, given its length n, and occurrences k, k(n-1)-(n+4) > 0. Solving for k, the formula becomes k > (n+4)/(n-1). Here's a reference table that makes it easy:

    length of       minimum         example(s)
    command         occurrences
    ------------------------------------------------
    2               6               if (consider renaming to "?")
    3               4               for, set (consider renaming to "=")
    4               3               eval, expr, incr (consider renaming to "+"), info, join, proc, puts, scan
    5               3               break, catch, lsort, split, subst, trace, unset, while
    6               3               format, lindex, lrange, regexp, regsub, rename, return, string, switch
    7               2               foreach, lappend, linsert, llength, lsearch, unknown
    .               2               lreplace
    .               2               continue
    .               2               
    
  4. Next, compact frequently used subcommands like

    = I index
    = L length
    

    so you can do things like

    S $I $x 7
    S $L $x
    
  5. Some obvious miscellanea:

    1. Consider using the ternary operator ? to compact multiple ifs.
    2. lappend can set the first element of a list if it doesn't yet exist (no need to initialize).
    3. You can set arrays without using array, e.g. set doesNotExist(7) 43.
    4. You can use strings ("a b c") instead of [list a b c].
    5. You can interpolate in strings like so: foo${a}bar.
    6. You can use two\ words rather than "two words". (Remember in general that for contiguous strings without spaces, double quotes can be omitted!)
    7. You can almost rewrite fors as whiles to save a character or two, since a while can simultaneously check and increment while a for uses separate blocks.
added 294 characters in body
Source Link
Loading
Source Link
Loading