sort_column() Error
- Posted by euphoric (admin) Jul 07, 2010
- 1217 views
sort_column() can sort by column 1, but it can't seem to sort by column 2... Can anybody figure out why?
include std/sort.e include std/console.e sequence s = "", letters = "abcdefghijklmnopqrstuvwxyz" integer rc, rn, SORTER = 1, SHOW = 7 for t=1 to 1000 do rc = rand(length(letters)) rn = rand(10000) s = append(s,{ letters[rc], rn }) end for while wait_key() != 27 entry do if SORTER = 1 then SORTER = 2 else SORTER = 1 end if entry s = sort_columns( s, {SORTER} ) printf(1,"\n\nSort by Column %d\n\n",{SORTER}) for t=1 to SHOW do puts(1,"\t" & s[t][1] & "\t") ?s[t][2] end for end while