Sort numbers lexicographically: Difference between revisions

Add Tcl
(Add Tcl)
Line 1,191:
21: [1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 3, 4, 5, 6, 7, 8, 9]
-22: [-1, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -2, -20, -21, -22, -3, -4, -5, -6, -7, -8, -9, 0, 1]</pre>
 
=={{header|Tcl}}==
<lang tcl>proc iota {num {start 0} {step 1}} {
set res {}
for {set i 0; set n $start} {$i < $num} {incr i; incr n $step} {
lappend res $n
}
return $res
}
 
puts [lsort [iota 13 1]]</lang>
{{out}}
<pre>1 10 11 12 13 2 3 4 5 6 7 8 9</pre>
 
=={{header|VBA}}==
Anonymous user