Sort of a problem
Jerry Jensen
jhj at jhj.com
Sat May 12 00:42:22 EDT 2012
The light bulb lit over my head a while ago when I understood a line from Jacque that scrambles the order of lines in a var:
sort lines of var by random(63000) -- or something similar
Elegant, that! the value after the "by" is calculated for every line, even without using "each".
On May 11, 2012, at 11:09 AM, Jim Hurley wrote:
> Thanks Jerry. That is what I was looking for.
>
> There is some magic going on behind the scenes with that "by ... of each" that I never really caught on to.
>
> Jim
>
>
>>
>> Message: 5
>> Date: Thu, 10 May 2012 21:23:36 -0700
>> From: Jerry Jensen <jhj at jhj.com>
>> To: How to use LiveCode <use-livecode at lists.runrev.com>
>> Subject: Re: Sort of a problem
>> Message-ID: <D53BDB2B-11CD-46B1-9F25-BA46E64A89A8 at jhj.com>
>> Content-Type: text/plain; charset=us-ascii
>>
>> This seems to do the job. No polish, but you'll get the idea.
>> .Jerry
>>
>> Aw, crap, forgot about no attachments. Here's the code:
>>
>> ------------------------------------------------
>>
>> on mouseUp
>> local tList
>> put fld "Streets" into tList
>> sort lines of tList by pickStreet(each)
>> put tList into fld "Streets"
>> end mouseUp
>>
>> function pickStreet pName
>> if word 1 of pName is in "NSEW" then
>> return word 2 to -1 of pName
>> else
>> return pName
>> end if
>> end pickStreet
>>
>> -----------------------------------------------------
>>
>
>
> _______________________________________________
> 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