Sort by length of line (Rant)
dunbarx at aol.com
dunbarx at aol.com
Mon Dec 12 23:29:52 EST 2011
My gut sense was that the sort should do what I wanted, that is, to assemble the list according to the number of chars in each line.
But the tool I used, "sort by the length of each", is working correctly.
The length of a line resolves to a number, and so you are, in the end, sorting a list of numbers, period. That needs to be sorted numerically to give the required results. We rely on this resolution in all aspects of LC. Even when a "do" construction is needed to implement a task that seems to otherwise read logically, we indulge the language with barely a whimper, and sort of understand a implicate, nested level of resolution that needs to be coaxed out.
Even if, and I tried it before posting, you "sort lines by the number of chars of each", you still resolve to numbers. The mental construct has no direct implementation in LC if you think about it, even though at first blush it seems like a natural solution. It is a tribute to the way simple direct ideas in ones head can be translated into LC routines that endears it to me. But the rules rule.
So what would be a possible "natural" method? In other words, what would translate the way our minds think? Certainly you could add a "text" sortkey to the command, but this would be a necessary adjunct. and in the end would only tell the engine to sort numerically after all. How about a "width of text in each" given a fixed width font? I can't really think of a "natural" way, can you?
From: Mark Wieder <mwieder at ahsoftware.net>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Mon, Dec 12, 2011 4:12 pm
Subject: Re: sort by length of line (Weird)
Monday, December 12, 2011, 5:18:26 PM, you wrote:
> I'm OK with it.
I'm sort of OK with it because there's a simple way to get the desired
answer. But I filed bug 9910 requesting the simplified syntax with
"numeric" being optional.
mwieder at ahsoftware.net
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
More information about the Use-livecode