sorting words ?

Mark Waddingham mark at livecode.com
Wed Dec 9 07:35:10 EST 2015


On 2015-12-09 12:41, jbv at souslelogo.com wrote:
> One more remark on this topic : it's surprising that words
> can't be sorted, when the following actually works :
>    get "95 1 3" & return & "95 2 1" & return & "125 1 2"
>    sort lines of it ascending numeric by word 3 of each
> 
> In that case, words are used as a sorting parameter; so why
> not use them also for sorting words in a variable ?
> What's the logic behind ?

Words can be separated by multiple spaces, so the question here is that 
what would sorting the words of:

the      quick brown  fox    jumped over     the lazy         dog

Give you?

If you want to sort by (single) space delimited things (i.e. not 
'words', which are both quoted and separated by multiple spaces) you can 
just change the item/line delimiter and use items/lines.

Basically the answer to your question is simply that:

a) It is not entirely obvious what 'sort the words of' should do.

b) The case of sorting a list of single space separated things is 
already available by fiddling with delimiters and using item/line 
chunks.

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list