It works fine. The "AB" goes to the top, because a blank always sorts before any alpha character ("AB" comes before "ABC"). But with the compound sort it does not. I have used this for decades, and only now am finding that it may not be universally sound.
on mouseUp
put empty into fld "daftLIST2"
put fld "daftLIST" into text2Sort
repeat with word2Sort = 3 to 1 step -1
sort lines of text2Sort by word word2Sort of each
end repeat
put text2Sort into field "daftLIST2"
end mouseUp
Cheers!
Rob Cozens dba Serendipity Software Company
Manchester, CA USA
Each new generation gives more attention to the man-made world...
and less attention to the world that made man.
I see what you mean. I always thought that was a special variant of "sort" and was designed to leave the words involved intact. I was obviously wrong, and the way you explain it, there was never any special "variant" at all. Well. That means that the method requires that all words be of the same length. It has been years since the last time I used this, er, sort of thing, but I almost cannot believe that for so long it has not broken something simple.
Anyway. I can think of kludges to "fix" it, like temporarily inserting low-ASCII chars to fill the voids, but that does not seem worthwhile at all.
I see what you mean. I always thought that was a special variant of "sort" and was designed to leave the words involved intact. I was obviously wrong, and the way you explain it, there was never any special "variant" at all. Well. That means that the method requires that all words be of the same length. It has been years since the last time I used this, er, sort of thing, but I almost cannot believe that for so long it has not broken something simple.
I double-checked "HyperTalk 2.2: The Book" and there's no multi-sort variant there either. Then I tried LC using the logical "and" rather than the concatenating "&" - still no go (though oddly it doesn't throw an error for the unused "and..." clause). Like the HC docs, the LC Dictionary has no example of multi-sort expression options.
It's a nice idea, but does not appear to have been implemented in an xTalk before.
Anyway. I can think of kludges to "fix" it, like temporarily inserting low-ASCII chars to fill the voids, but that does not seem worthwhile at all.
Given that LC uses a stable sort, no need to alter the data. Just do multiple sorts one at a time and you'll get exactly what you're looking for.
Richard Gaskin LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
I did not make that up. But in my rather extensive HC library, I could not find it either. It must be some aside that is not linked to "sort" in the index.
I have Danny G's HC 2.2 book on my lap and Danny G's Hypercard Developers Guide 1988 as a PDF up on a screen.
The latter one mentions "Dual Key" Sorts, but that seems to refer to 2 fields . . . threw me into the left field as Goodman's
style is anything if not clunky.
Certainly the former's Chapter 29 on Searching and Sorting does not mention anything quite resembling the