Re: SORT by length

2017-08-08 Thread panagiotis merakos via use-livecode
@Bob this is a bug, introduced in LC 8: http://quality.livecode.com/show_bug.cgi?id=18699 On Tue, Aug 8, 2017 at 4:52 PM, Bob Sneidar via use-livecode < use-livecode@lists.runrev.com> wrote: > On my Mac I get double line breaks when I paste into Apple Mail. The prefs > are already set to plain t

Re: SORT by length

2017-08-08 Thread Bob Sneidar via use-livecode
On my Mac I get double line breaks when I paste into Apple Mail. The prefs are already set to plain text, so I am not sure why I am still getting the double line breaks. In TextEdit I get single line breaks. Obviously the text editor understands that I didn't really mean cr/lf (or whatever is ac

Re: SORT by length

2017-08-08 Thread Mark Wieder via use-livecode
On 08/08/2017 07:39 AM, Bob Sneidar via use-livecode wrote: Paste it into a text only text editor first and you won't get the double line breaks either. I paste from LC directly into Thunderbird regularly. Look in the Preferences | Composition pane There's an option at the bottom for "Configur

Re: SORT by length

2017-08-08 Thread Bob Sneidar via use-livecode
Paste it into a text only text editor first and you won't get the double line breaks either. Bob S > On Aug 8, 2017, at 01:46 , Richmond Mathewson via use-livecode > wrote: > > Sorry about the asterisks . . . > > That is what happens when one copy-pastes directly from the LiveCode > scrip

Re: SORT by length

2017-08-08 Thread hh via use-livecode
splay > Formatting - Advanced button @Sort by length As several others said: sort str [ascending|descending] numeric by length(each) works perfectly. But the first part of your script sorts correctly numeric by length if and only if there is NO COMMA in the string to sort ... You sort by

Re: SORT by length

2017-08-08 Thread Richmond Mathewson via use-livecode
Sorry about the asterisks . . . That is what happens when one copy-pastes directly from the LiveCode scriptEditor into Thunderbird. on mouseUp put empty into rSortByLength put fld "CL" into tText repeat for each word tLine in tText put tLine&"," &the length of tLine&return after rSortByLen

Re: SORT by length

2017-08-07 Thread Terry Judd via use-livecode
sort lines of fld “myGuff” descending numeric by length(each) – should do it. Terry... On 8/08/2017 8:23 am, "use-livecode on behalf of Richmond Mathewson via use-livecode" wrote: I have a listField containing a number of words which I want to order so the longest comes first . .

Re: SORT by length

2017-08-07 Thread Jerry Jensen via use-livecode
So what did it do? With all those asterisks I can’t run it without retyping the whole thing. > On Aug 7, 2017, at 3:42 PM, Richmond Mathewson via use-livecode > wrote: > > That scr*wed up badly. > > I found this: http://forums.livecode.com/viewtopic.php?f=9&t=10505#p48529 > > and modified it

Re: SORT by length

2017-08-07 Thread Richmond Mathewson via use-livecode
That scr*wed up badly. I found this: http://forums.livecode.com/viewtopic.php?f=9&t=10505#p48529 and modified it: *on**mouseUp* ** ***put**empty **into**rSortByLength* ** ***put**fld "CL" **into**tText* ** ***repeatfor**each word tLine in tText* ** ***put**tLine&"," &**thelengt

Re: SORT by length

2017-08-07 Thread Richmond Mathewson via use-livecode
Thanks: that looks remarkably simple. I suppose the "trick" is knowing which word to look up in the Dictionary ;-) Richmond. On 8/8/17 1:29 am, Jerry Jensen via use-livecode wrote: From the dictionary entry for “sort”: If you don't specify a direction, the sort is ascending. One of the follow

Re: SORT by length

2017-08-07 Thread Jerry Jensen via use-livecode
From the dictionary entry for “sort”: If you don't specify a direction, the sort is ascending. One of the following items: • ascending -sorts in ascending order • descending -sorts in descending order > On Aug 7, 2017, at 3:23 PM, Richmond Mathewson via use-livecode > wrote: > >

SORT by length

2017-08-07 Thread Richmond Mathewson via use-livecode
I have a listField containing a number of words which I want to order so the longest comes first . . . doing this: sort lines of fld "myGuff" by length(each) sorts the words, but the shortest one comes first... Richmond. ___ use-livecode mailing lis

Re: sort by length of line (Weird)

2011-12-13 Thread Bob Sneidar
eerm... yes we can. Bob On Dec 13, 2011, at 2:20 PM, Mark Wieder wrote: > in the same > way that we can't just say "add 1 to x" ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage yo

Re: sort by length of line (Weird)

2011-12-13 Thread Mark Wieder
Richard- Tuesday, December 13, 2011, 1:48:56 PM, you wrote: > There are others, and they wind up consuming a fair amount of time when > I'm teaching someone LiveCode for the first time. > Exceptions require memorization, and with a language this broad it can > helpful to keep the rule set as sma

Re: sort by length of line (Weird)

2011-12-13 Thread Richard Gaskin
Mark Wieder wrote: Richard- Good points all. I'm not requesting that the sort command be smart enough to handle all situations, but this is enough of a confusing point that I think the engine could benefit from some extra smarts. A simple parsing optimization for cases like sort tVar by length

Re: sort by length of line (Weird)

2011-12-13 Thread Mark Wieder
Richard- Good points all. I'm not requesting that the sort command be smart enough to handle all situations, but this is enough of a confusing point that I think the engine could benefit from some extra smarts. A simple parsing optimization for cases like sort tVar by length(each) could insert t

Re: sort by length of line (Weird)

2011-12-13 Thread Mark Wieder
stephen- Tuesday, December 13, 2011, 11:32:30 AM, you wrote: > A downside with plain english style programming code methods is that this > can lead to uncontrolled bouts of alliteration, pun-making and double > entendre. Basic and COBOL people don't talk that way. CONTINUE. -- -Mark Wieder mw

Re: sort by length of line (Weird)

2011-12-13 Thread Mark Wieder
Pete- Tuesday, December 13, 2011, 10:05:05 AM, you wrote: > I think Mark's point is specifically to do with the length function which > can only return a numeric value. The suggestion is that the sort command > should be smart enough to know that and automatically use a numeric sort > (unless ov

Re: sort by length of line (Weird)

2011-12-13 Thread stephen barncard
A downside with plain english style programming code methods is that this can lead to uncontrolled bouts of alliteration, pun-making and double entendre. Basic and COBOL people don't talk that way. On 13 December 2011 10:45, Pete wrote: > Nice! I wish that had been a conscious play on words. >

Re: sort by length of line (Weird)

2011-12-13 Thread Mark Wieder
Colin- Tuesday, December 13, 2011, 10:04:50 AM, you wrote: > How did you sort those lines, before reading between them? Note to self: file enhancement request for sort between the lines of -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode

Re: sort by length of line (Weird)

2011-12-13 Thread Pete
Nice! I wish that had been a conscious play on words. On Tue, Dec 13, 2011 at 10:04 AM, Colin Holgate wrote: > How did you sort those lines, before reading between them? > > > On Dec 13, 2011, at 12:29 PM, Pete wrote: > > > Looks like your bug report got changed to an enhancement request with n

Re: sort by length of line (Weird)

2011-12-13 Thread Bob Sneidar
You have to read between them to know how not to sort. Bob On Dec 13, 2011, at 10:04 AM, Colin Holgate wrote: > How did you sort those lines, before reading between them? > > > On Dec 13, 2011, at 12:29 PM, Pete wrote: > >> Looks like your bug report got changed to an enhancement request wit

Re: sort by length of line (Weird)

2011-12-13 Thread Pete
I think Mark's point is specifically to do with the length function which can only return a numeric value. The suggestion is that the sort command should be smart enough to know that and automatically use a numeric sort (unless overridden) since it's not possible for text data to be produced. I a

Re: sort by length of line (Weird)

2011-12-13 Thread Colin Holgate
How did you sort those lines, before reading between them? On Dec 13, 2011, at 12:29 PM, Pete wrote: > Looks like your bug report got changed to an enhancement request with not > much chance of happening (reading between the lines). ___ use-livecode m

Re: sort by length of line (Weird)

2011-12-13 Thread Richard Gaskin
Mark Wieder wrote: 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. Respectfully, I think it may be asking a bit much of the engine - and perhaps the scripter - to expect the eng

Re: sort by length of line (Weird)

2011-12-13 Thread Pete
Hi Mark, Looks like your bug report got changed to an enhancement request with not much chance of happening (reading between the lines). On Mon, Dec 12, 2011 at 6:10 PM, Mark Wieder wrote: > Craig- > > Monday, December 12, 2011, 5:18:26 PM, you wrote: > > > I'm OK with it. > > I'm sort of OK wit

Re: sort by length of line (Weird)

2011-12-13 Thread Bob Sneidar
I went to bed thinking about this. Think about what would have to happen for Livecode to conclude this needed to be a numeric sort: It would have to evaluate every line in the sort, and if it found just one line that was not a number, it would have to then use a text sort. What if the list was 1

Sort by length of line (Rant)

2011-12-12 Thread dunbarx
? I can't really think of a "natural" way, can you? Craig -Original Message- From: Mark Wieder To: How to use LiveCode Sent: Mon, Dec 12, 2011 4:12 pm Subject: Re: sort by length of line (Weird) Craig- Monday, December 12, 2011, 5:18:26 PM, you wrote: > I'm

Re: sort by length of line (Weird)

2011-12-12 Thread Mark Wieder
Craig- 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. -- -Mark Wieder mwie...@ahsoftware.net _

Re: sort by length of line (Weird)

2011-12-12 Thread Mark Wieder
Bob- Monday, December 12, 2011, 3:56:31 PM, you wrote: > It is doing just that, only it's doing a text sort of the numbers: > 1 > 10 > 100 > 11 > 12 > etc. Yes, and that's just wrong. I can think of no problem for which that is the solution. -- -Mark Wieder mwie...@ahsoftware.net __

Re: sort by length of line (Weird)

2011-12-12 Thread dunbarx
Original Message- From: Bob Sneidar To: How to use LiveCode Sent: Mon, Dec 12, 2011 1:58 pm Subject: Re: sort by length of line (Weird) It is doing just that, only it's doing a text sort of the numbers: 1 10 100 11 12 etc. He wants a NUMERIC sort of the numbers. Hence sort myVar

Re: sort by length of line (Weird)

2011-12-12 Thread Bob Sneidar
It is doing just that, only it's doing a text sort of the numbers: 1 10 100 11 12 etc. He wants a NUMERIC sort of the numbers. Hence sort myVar numeric by the length of each Bob On Dec 12, 2011, at 11:56 AM, Mark Wieder wrote: > OK - that's just weird. I see what's going on, but what I'd expect

Re: sort by length of line (Weird)

2011-12-12 Thread Ken Ray
On Dec 12, 2011, at 1:56 PM, Mark Wieder wrote: > OK - that's just weird. I see what's going on, but what I'd expect is what (I > think) Craig expects - that I'd get a list of the strings sorted by their > character lengths. > > Is there *any* use case in which you'd want strings sorted by the a

Re: sort by length of line (Weird)

2011-12-12 Thread dunbarx
ec 12, 2011 9:59 am Subject: Re: sort by length of line (Weird) OK - that's just weird. I see what's going on, but what I'd expect is what (I think) Craig expects - that I'd get a list of the strings sorted by their character lengths. Is there *any* use case in which you

Re: sort by length of line (Weird)

2011-12-12 Thread dunbarx
Well, well. I never would have thought it was doing that, though I get it. Thanks all. -Original Message- From: Ken Ray To: How to use LiveCode Sent: Mon, Dec 12, 2011 8:08 am Subject: Re: sort by length of line (Weird) On Dec 12, 2011, at 11:09 AM, Mark Schonewille wrote

Re: sort by length of line (Weird)

2011-12-12 Thread Mark Wieder
OK - that's just weird. I see what's going on, but what I'd expect is what (I think) Craig expects - that I'd get a list of the strings sorted by their character lengths. Is there *any* use case in which you'd want strings sorted by the alphabetic representations of their lengths? I can't think of

Re: sort by length of line (Weird)

2011-12-12 Thread Colin Holgate
I figured it out, and it's a funny little issue! It is doing the sort correctly, but is evaluating the length of the words in an alphabetic way. The 10 letter words are alphabetically shorter than the 9 letter words, because "10" comes before "9". You can solve it like this: sort fld 2 numeric

Re: sort by length of line (Weird)

2011-12-12 Thread stephen barncard
Which is a also a great (and fastest) way to get the max width of text in a column. get fld "B" sort lines of it numeric *descending* by number of characters of each put number of characters in line 1 of it into tWidest_Word_Width don't you just love BINARY?? On 12 December 2011 09:09, Mark S

Re: sort by length of line (Weird)

2011-12-12 Thread Ken Ray
On Dec 12, 2011, at 11:09 AM, Mark Schonewille wrote: > Try numeric. Right - Here's an explanation: when you sort by length, what gets sorted is the actual *numbers* themselves, so unless you tell LC to "sort numeric", you'll get things in this order: 1 10 11 2 3 4

Re: sort by length of line (Weird)

2011-12-12 Thread Mark Schonewille
Try numeric. -- Kind regards, Mark Schonewille Economy-x-Talk Http://economy-x-talk.com Share the clipboard of your computer over a local network with Clipboard Link http://clipboardlink.economy-x-talk.com Op 12 dec. 2011 om 17:55 heeft dunb...@aol.com het volgende geschreven: > Hmmm. > >

Re: sort by length of line (Weird)

2011-12-12 Thread dunbarx
-Original Message- From: Mark Schonewille To: How to use LiveCode Sent: Sun, Dec 11, 2011 6:54 pm Subject: Re: sort by length of line Hi Craig, sort lines of myList by length(each) sort lines of myList by the length of each sort lines of myList by number of chars of each "Eac

Re: sort by length of line

2011-12-11 Thread Mark Schonewille
Hi Craig, sort lines of myList by length(each) sort lines of myList by the length of each sort lines of myList by number of chars of each "Each" is simply the element that's currently being sorted, as if you put a repeat loop into one line of syntax. -- Best regards, Mark Schonewille Economy-

Re: sort by length of line

2011-12-11 Thread Devin Asay
On Dec 11, 2011, at 9:04 PM, wrote: > > I can do this the long way, but is there a clever sortkey that will sort > lines by the length of those lines? > > In other words, if I have a variable myVar with: > > aaa > xxx > > > I want to write something like: > > sort myVar by the len

sort by length of line

2011-12-11 Thread dunbarx
Sorry, should have made a new thread. I can do this the long way, but is there a clever sortkey that will sort lines by the length of those lines? In other words, if I have a variable myVar with: aaa xxx I want to write something like: sort myVar by the length of each to