Re: sorting questing

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

On Fri, 28 Apr 2000 20:20:48 +0100, John McAdam wrote:

>I have a list of words that I want to sort by word length.
>The longest words first, down to the shortest word.
>Do I make another sequence that holds the word length,
>then sort that? If so, then how to relate the two lists?
>Its probably a simple algorithm, but its been a hard week
>and I can't get it to work out.

One possible solution would be to 'prepend' the length of each sequence
element to each sequence element (so each element is like { 4, "word" } )
then run that through 'sort', then 'reverse' it.

-- Brian

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

Search



Quick Links

User menu

Not signed in.

Misc Menu