| Description: |
If you do:
package require struct::list 1.8.1
struct::list nextperm {1 10 9 8 7 6 5 4 3 2}
You get a script that takes an excessively long time to respond (and that will eventually produce a weird error; might take a *long* time!). The problem is that there is a loop that has the wrong condition, using '>=' as an ordering relation directly on values (that happen to be numeric) rather than using [string compare] to do the comparison.
Change:
while { $aj >= [set al [lindex $perm $l]] } {
to:
while { [string compare $aj [set al [lindex $perm $l]]] >= 0 } {
This will fix the problem by making string comparison be used throughout.
|