sorting words ?

Mark Waddingham mark at livecode.com
Wed Dec 9 15:16:18 EST 2015


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




More information about the Use-livecode mailing list