Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-20 Thread Ken Ray
It's very handy, but a cognitive hurdle for me at first. I'd never seen anything like it before. Anyone else have a mental hiccup when they first encountered this? Absolutely! Which is why there's couple of tips about this at my site:

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-19 Thread Peter Brigham
I believe I discovered that this custom sort function has to be modified in one tiny way to work properly. Instead of sort lines of fld 1 by valueList(word 1 of each) you have to do sort lines of fld 1 numeric by valueList(word 1 of each) The valueList function returns a number, so the sort

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-19 Thread Richard Gaskin
J. Landman Gay wrote: But wait, there's more! Some time ago when the list was discussing custom parallel sorts, Dick Kriesel offered this enhancement: split varB by comma sort items of varA by varB[itemOffset(each,varA)] If Dick's still reading the list, he should stand up and take a bow.

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-19 Thread Hugh Senior
A good point, Peter. It would not affect the example as only 7 day-values are involved, but longer value lists would indeed be affected. on mouseUp sort lines of fld 1 numeric by valueList(word 1 of each) end mouseUp function valueList what put

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-18 Thread Hugh Senior
This is very elegant. With a little more tweaking, you could use it to choose any of more than 2 values! Now in the Scripter's Scrapbook. Thank you, Jacque. /H J. Landman Gay wrote: function whichOne var,fld1,fld2 -- from a handler by Tony Root -- Handles a case where you need to return one

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread Richard Gaskin
Hugh Senior wrote: Have you needed to sort lists by a value list or synchronize different lists, but thought it not easily do-able in Rev? You may find the following tips useful. In a field, type some lines where the first word is a random day of the week, then... on mouseUp sort lines

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread J. Landman Gay
Richard Gaskin wrote: Hugh Senior wrote: Have you needed to sort lists by a value list or synchronize different lists, but thought it not easily do-able in Rev? You may find the following tips useful. In a field, type some lines where the first word is a random day of the week, then... on

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread Mark Smith
Richard, if you look at the 'valueList' function, it returns a number ie. the offset of a weekday name into the list of weekday names. It's this value that is being used to sort the list. It's like attaching a temporary value to each line and sorting by that. If there were more than 9

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread Jim Ault
On 6/17/08 2:49 PM, Richard Gaskin [EMAIL PROTECTED] wrote: full text of the question appears below I've never before seen a sort where the sort specifier is a literal value. :\ What exactly does that do, and how does it do it? And where did you learn how do that? I can't find anything in

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread Richard Gaskin
J. Landman Gay wrote: Richard Gaskin wrote: on mouseUp on mouseUp sort lines of fld 1 by valueList(word 1 of each) end mouseUp function valueList what put Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday into tList return itemOffset(what,tList) end valueList If I

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread Mark Smith
On 17 Jun 2008, at 23:57, Richard Gaskin wrote: But I guess I'm stuck on the old (outdated?) notion that functions are evaluated before their result is used in the calling command, which would mean the calling sort command is effectively using: sort lines of fld 1 by 1 Except that

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread Richard Gaskin
Mark Smith wrote the magic phrase that made this much clearer to me: It's like attaching a temporary value to each line and sorting by that. The moment of a ha! Thank you, Mark. Jim Ault's detailed explanation was also helpful. So this tells me two things: 1. Using a function for a

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread J. Landman Gay
Richard Gaskin wrote: But I guess I'm stuck on the old (outdated?) notion that functions are evaluated before their result is used in the calling command, It's still doing that. The function is evaluated first, before the sort assigns it a position. The difference here is that each is

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread J. Landman Gay
Richard Gaskin wrote: 1. Using a function for a sortKey expression introduces a sometimes rule in terms of understanding the order of expression evaluation in the engine, in which most of the time functions are evaluated first but in this case the function is applied repeatedly for each line

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread Richard Gaskin
Richard Gaskin wrote: So this tells me two things: 1. Using a function for a sortKey expression introduces a sometimes rule in terms of understanding the order of expression evaluation in the engine, in which most of the time functions are evaluated first but in this case the function is

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread Richard Gaskin
J. Landman Gay wrote: Richard Gaskin wrote: 1. Using a function for a sortKey expression introduces a sometimes rule in terms of understanding the order of expression evaluation in the engine, in which most of the time functions are evaluated first but in this case the function is applied

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread J. Landman Gay
Richard Gaskin wrote: It's very handy, but a cognitive hurdle for me at first. I'd never seen anything like it before. You probably blocked it. :) http://search.gmane.org/?query=custom+sortgroup=gmane.comp.ide.revolution.user Anyone else have a mental hiccup when they first encountered

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread Richard Gaskin
J. Landman Gay wrote: Richard Gaskin wrote: It's very handy, but a cognitive hurdle for me at first. I'd never seen anything like it before. You probably blocked it. :) http://search.gmane.org/?query=custom+sortgroup=gmane.comp.ide.revolution.user Wow. So many posts I've overlooked.

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread J. Landman Gay
Richard Gaskin wrote: In other languages that's called iff. Whoa, I didn't know there was a name for it. Makes sense, since Tony came to HyperCard from other languages. So he was probably translating. Paul's/Tony's implementation is very clever, but I believe it benchmarks a bit faster

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread Jerry J
From: Richard Gaskin [EMAIL PROTECTED] But I guess I'm stuck on the old (outdated?) notion that functions are evaluated before their result is used in the calling command The AHA moment for me was some time ago when Jacque shared the beautiful line to shuffle something: sort something by

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-17 Thread J. Landman Gay
But wait, there's more! Some time ago when the list was discussing custom parallel sorts, Dick Kriesel offered this enhancement: split varB by comma sort items of varA by varB[itemOffset(each,varA)] If Dick's still reading the list, he should stand up and take a bow. -- Jacqueline Landman

[TIP] Sorting by ValueList and synchronized sorting

2008-06-14 Thread Hugh Senior
Have you needed to sort lists by a value list or synchronize different lists, but thought it not easily do-able in Rev? You may find the following tips useful. In a field, type some lines where the first word is a random day of the week, then... on mouseUp sort lines of fld 1 by

Re: [TIP] Sorting by ValueList and synchronized sorting

2008-06-14 Thread Phil Davis
Thanks Hugh! This is quite cool. Phil Davis Hugh Senior wrote: Have you needed to sort lists by a value list or synchronize different lists, but thought it not easily do-able in Rev? You may find the following tips useful. In a field, type some lines where the first word is a random day of