Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
4
Task/Introspection/Tcl/introspection-1.tcl
Normal file
4
Task/Introspection/Tcl/introspection-1.tcl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
package require Tcl 8.4 ; # throws an error if older
|
||||
if {[info exists bloop] && [llength [info functions abs]]} {
|
||||
puts [expr abs($bloop)]
|
||||
}
|
||||
14
Task/Introspection/Tcl/introspection-2.tcl
Normal file
14
Task/Introspection/Tcl/introspection-2.tcl
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
namespace eval ::extra_credit {
|
||||
variable sum_global_int 0
|
||||
variable n_global_int 0
|
||||
foreach var [info vars ::*] {
|
||||
if {[array exists $var]} continue
|
||||
if {[string is int -strict [set $var]]} {
|
||||
puts "$var = [set $var]"
|
||||
incr sum_global_int [set $var]
|
||||
incr n_global_int
|
||||
}
|
||||
}
|
||||
puts "number of global ints = $n_global_int"
|
||||
puts "their sum = $sum_global_int"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue