sorting words ?

dunbarx at aol.com dunbarx at aol.com
Wed Dec 9 16:27:45 EST 2015


Geoff nailed it, all right.


The "word" chunk has always been loosely implemented, in that it can hardly be considered a truly delimited chunk at all, like an item or a line is. Even though it seems to have been included in the "family" of chunks.


Human brains seemed to have been able to accommodate this, most historic threads dealing with the such issues as the fact that multiple spaces "delimiting" words are not individually counted, or that quotes around multiple, er, words are a single word. And that delimiters reserved for other ("larger") chunks often find themselves embedded in a string of words, without affecting that string at all.


That sort of thing.


My point is that the advice you have been given, that you have to choose your words carefully, using some explicit delimiter and run with it, cuts through all that loosey-goosey stuff. In only that way can you control the text you are dealing with.


Craig Newman 






-----Original Message-----
From: Mark Waddingham <mark at livecode.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Wed, Dec 9, 2015 3:17 pm
Subject: Re: sorting words ?

You explained the issue far better than me :)

The proposed meaning is the most sensible 'consistent' interpretation I think as it preserves the list structure if not the original data entirely.

Sent from my iPhone

> On 9 Dec 2015, at 19:20, Geoff Canyon <gcanyon at gmail.com> wrote:
> 
> Note that words can also be delimited by tabs and crs, which doesn't allow
> for a simple substitution for sorting by items/lines, and would make for
> some odd results pretty much no matter what method you use. There is also
> the fact that this is six words:
> 
> test
> this thing  and this
> "thing right here"
> 
> I *think* the sensible output to sorting the above would be:
> 
> and test thing "thing right here" this this
> 
> each separated by a single space, with no leading or trailing spaces.
> 
>> On Wed, Dec 9, 2015 at 11:28 AM, <jbv at souslelogo.com> wrote:
>> 
>> Well, I don't want to keep this thread going forever but still...
>> I do understand Mark's explanations, but still I don't understand
>> this :
>> 
>> since this is allowed (and returns the expected result) :
>>   get "the      quick brown  fox    jumped over     the lazy         dog"
>>   set itemdel to space
>>   sort items of it ascending
>> 
>> why not have the engine temporarily replacing the current itemdel
>> with space, do the sorting of words, and then setting itemdel back to its
>> previous value... Of course this would be transparent to the coder...
>> Some will say "what's the use ? Simply set the itemdel to space"...
>> But this would allow words sorting, as well as sorting in more
>> complex data structures, such as words inside items inside lines...
>> 
>> jbv
>> 
>> 
>>>> On 2015-12-09 13:42, jbv at souslelogo.com wrote:
>>>> Hi Mark,
>>>> 
>>>> I am probably missing something, but items can be separated by multiple
>>>> itemdelimiters too, but nevertheless the sorting function works, as in
>>>> this
>>>> example :
>>>>   get "12,5,,4,10,,,11,24"
>>>>   sort items of it ascending numeric
>>>> 
>>>> it returns ,,,4,5,10,11,12,24
>>>> and no compilation error...
>>> 
>>> Right - but:
>>> 
>>> "1,2,,,,3,4,5"
>>> 
>>> Is a list of 8 items - 3 of them empty.
>>> 
>>> "the    quick   brown fox  jumped"
>>> 
>>> Is a list of 5 words - multiple item delimiters mean something, multiple
>>> spaces are just a single 'delimiter' in this context.
>>> 
>>> Warmest Regards,
>>> 
>>> Mark.
>>> 
>>> 
>>> --
>>> Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
>>> LiveCode: Everyone can create apps
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list