Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
15
Task/Optional-parameters/Tcl/optional-parameters-1.tcl
Normal file
15
Task/Optional-parameters/Tcl/optional-parameters-1.tcl
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
proc tablesort {table {ordering ""} {column 0} {reverse 0}} {
|
||||
set direction [expr {$reverse ? "-decreasing" : "-increasing"}]
|
||||
if {$ordering ne ""} {
|
||||
lsort -command $ordering $direction -index $column $table
|
||||
} else {
|
||||
lsort $direction -index $column $table
|
||||
}
|
||||
}
|
||||
|
||||
puts [tablesort $data]
|
||||
puts [tablesort $data "" 1]
|
||||
puts [tablesort $data "" 0 1]
|
||||
puts [tablesort $data {
|
||||
apply {{a b} {expr {[string length $a]-[string length $b]}}}
|
||||
}]
|
||||
Loading…
Add table
Add a link
Reference in a new issue