Sort numbers lexicographically: Difference between revisions
Content added Content deleted
(Add Tcl) |
(Tcl: better iota) |
||
Line 1,194: | Line 1,194: | ||
=={{header|Tcl}}== |
=={{header|Tcl}}== |
||
<lang tcl>proc iota {num {start 0} {step 1}} { |
<lang tcl>proc iota {num {start 0} {step 1}} { |
||
set res {} |
|||
set end [+ $start [* $step $num]] |
|||
for {set n $start} {$n != $end} {incr n $step} { |
|||
lappend res $n |
|||
} |
|||
} |
|||
return $res |
|||
} |
} |
||