sort_column() Error

new topic     » topic index » view thread      » older message » newer message

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 
new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu