"unknown" command usage 
Author Message
 "unknown" command usage

'Unknown' is a mighty way to extend Tcl beyond the limits of its core
syntax. The following few lines extend the original 'unknown' proc, by
specifying a condition and a body to be executed when the condition
evaluates to nonzero (like in 'if'):

 proc know {cond body} {



        }
    }][info body unknown]
 }
Example uses:

 know {[expr $args] || 1} {expr $args}
 % 1+2 * 3
 7

 know {[regexp {^([0-9]+)\.\.([0-9]+)$} [lindex $args 0] -> from to]} {
    set res {}
    while {$from<=$to} {lappend res $from; incr from}
    set res
 }
 % 1..6
 1 2 3 4 5 6

More at "Let unknown know", http://www.*-*-*.com/
--
Schoene Gruesse/best regards, Richard Suchenwirth - +49-7531-86 2703
Siemens Dematic AG, PA RC D2, Buecklestr.1-5, 78467 Konstanz,Germany
Personal opinions expressed only unless explicitly stated otherwise.



Sat, 05 Jun 2004 14:49:51 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. "unknown" command usage

2. "Unknown Command: -quiet" in mingw

3. "unknown" command HELP

4. The usage of the command "source"

5. Help with an "unknown" APL2 symbol

6. Unknown Variable "%AppTemplateFamily"

7. ERROR "Corrupt Block/Unknown Block Freed"

8. ANYONE ELSE GETTING "UNKNOWN" NEWS POSTINGS

9. CP shows "Unknown Image Format"

10. +define+unknown="'bx" chokes verilog

11. PTUI problem, "lifo::lifo": unknown namespace

12. TK: question about "-command" usage with "{}" and double quoter

 

 
Powered by phpBB® Forum Software