Re: sorting questing
- Posted by "Cuny, David at DSS" <David.Cuny at DSS.CA.GOV> Apr 28, 2000
- 544 views
John McAdam wrote:
> I have a list of words that I want to sort
> by word length.
How about:
include sort.e
sequence q
q = { "z", "foo", "bar", "ba", "grill", "za" }
-- attach the negative length
for i = 1 to length( q ) do
q[i] = { -length(q[i]), q[i] }
end for
-- sort
q = sort( q )
-- display; element #2 is the text
for i = 1 to length( q ) do
puts( 1, q[i][2] & '\n' )
end for
-- David Cuny

