On Monday, January 13, 2003, at 11:30 AM, Jim Hurley wrote:

 sort lines of vChooseFrom by random(10000)  -- or some suitably big
 number
 return line 1 to vNumToChoose of vChooseFrom

 I see how this works, and it is deliciously simple, but I don't see
 why. According to the documentation:

 > "The shortKey is a chunk expression that specifies which part of each
 line is used as the sort key. "
Here is my guess.  You can probably try some tests to see if it is
right.

You are missing the very tiny print after "sortKey".  If you look very,
very, very closely, the doc will read like this:

"The sortKey is an expression, typically a chunk expression that
specifies ..."

This command:

sort lines of ... by blahBlahBlah

gets a sort key by calling (virtually) this function on each line:

function sortKey each
    return blahBlahBlah
end if

If I'm right, you should be able to do other interesting sorts.

Dar Scott

Dar,

Thanks you for your insight.

This sort command makes Transcript complete for me: A mystery function. We all need a little mystery in our lives.

I will add the congruity of the two lines:

sort lines of field thisField by word 1 of each
sort lines of field thisField by random(2000)

to my list of zen koans for meditation. I think I have exhausted the sound of one hand clapping.

Jim
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to