Re: "repeat for each" in reverse order ?

2005-08-13 Thread Alex Tweedly

Jim Bufalini wrote:


JB

put the number of [whatever] into j   -- See note:
repeat with i = j down to 1

If you put the first line in the loop as in "i = the number of [whatever]
down to 1" the number of would be evaluated each time, I believe, and be
slower.
 


No, they wouldn't be - they're calculated once only. From the docs:



As with the "for number times" form described above, the startValue 
and endValue are evaluated when the loop is first entered, and are not 
re-evaluated as a result of any actions performed in the statementList.


And although it doesn't say it there, the same is also true for the 
"step" value if used.


--
Alex Tweedly   http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.1/28 - Release Date: 24/06/2005

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: "repeat for each" in reverse order ?

2005-08-13 Thread Jim Bufalini
Alex, thanks. That's good to know. -Jim

-Original Message-
From: Alex Tweedly [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 25, 2005 12:33 AM
To: [EMAIL PROTECTED]; How to use Revolution
Subject: Re: "repeat for each" in reverse order ?


Jim Bufalini wrote:

>JB
>
>put the number of [whatever] into j   -- See note:
>repeat with i = j down to 1
>
>If you put the first line in the loop as in "i = the number of [whatever]
>down to 1" the number of would be evaluated each time, I believe, and be
>slower.
>  
>
No, they wouldn't be - they're calculated once only. From the docs:

>
> As with the "for number times" form described above, the startValue 
> and endValue are evaluated when the loop is first entered, and are not 
> re-evaluated as a result of any actions performed in the statementList.
>
And although it doesn't say it there, the same is also true for the 
"step" value if used.

-- 
Alex Tweedly   http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.1/28 - Release Date: 24/06/2005





___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-08-13 Thread jbv


Jim,

according to some tests I did, "the number of..." is
evaluated only once, and both versions have the same
execution time.

JB

> JB
>
> put the number of [whatever] into j   -- See note:
> repeat with i = j down to 1
>
> If you put the first line in the loop as in "i = the number of [whatever]
> down to 1" the number of would be evaluated each time, I believe, and be
> slower.
>
> Jim
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of jbv
> Sent: Friday, June 24, 2005 11:05 PM
> To: How to use Revolution
> Subject: "repeat for each" in reverse order ?
>
> Hi list,
>
> Is there a way to use
> "repeat for each element thisIndexTerm in listOfTerms"
> in reverse order, like in
> "repeat with i=number of items of myVar down to 1" ?
>
> Thanks,
> JB
>

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-29 Thread Dennis Brown

Wouter,

While some variation on the example I showed could be useful and  
faster than some other possible script variations, all the high level  
script commands to simulate low level operations are a speed killer  
relative to the speed of a native method.  The repeat for each is  
truly awesome in its speed, and that is the speed that I would like  
to see in a more flexible primitive.


Dennis

On Jun 29, 2005, at 7:16 PM, Buster wrote:


Hi Dennis,

 I'm just curious, but what is wrong with itemOffset?

Greetings,
Wouter




Re: "repeat for each" in reverse order ?
Dennis Brown
Tue, 28 Jun 2005 07:59:41 -0700

What I would like to see is a way to access the next or previous  
"element" in a list independent of the repeat structure. We have  
something similar in the offset function --offset  
(findString,searchString,skipChars). The key is to have a concept  
for a pointer of sorts. The pointer in the offset function is the  
skipChars parameter. You could just about simulate this capability  
using the offset function (not tested):


global gStringName,gStringNamePtr
function nextItemStringName --don't want to pass the actual strings
get offset(itemDel(), gStringName, gStringNamePtr)
if it = 0 then --delimiter not found, must be end of string
return char gStringNamePtr to -1 of gStringName --last item in the  
string, or empty

else
return char gStringNamePtr to gStringNamePtr +it-1 of gStringName  
--grab the next item put it+1 into gStringNamePtr --advance the  
pointer to after the delimiter

end if
end nextItemStringName

Of course this way of doing it is not so general, a bit awkward,  
and the function calls would kill a lot of the potential speed.  
That is why a built-in function would be much better. Perhaps a  
syntax something like this:


nextItem(stringName,charOffsetVar)

The variable name specified for the charOffsetVar would have the  
pointer that gets modified.


You could also make it a command something like:

nextThing stringName with charOffsetVar by item

Having sequential access methods like this would allow a much  
greater freedom to process one or more lists at the same time  
without suffering the usual speed penalties.


Dennis



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-29 Thread Buster

Hi Dennis,

 I'm just curious, but what is wrong with itemOffset?

Greetings,
Wouter



Re: "repeat for each" in reverse order ?
Dennis Brown
Tue, 28 Jun 2005 07:59:41 -0700

What I would like to see is a way to access the next or previous  
"element" in a list independent of the repeat structure. We have  
something similar in the offset function --offset  
(findString,searchString,skipChars). The key is to have a concept  
for a pointer of sorts. The pointer in the offset function is the  
skipChars parameter. You could just about simulate this capability  
using the offset function (not tested):


global gStringName,gStringNamePtr
function nextItemStringName --don't want to pass the actual strings
get offset(itemDel(), gStringName, gStringNamePtr)
if it = 0 then --delimiter not found, must be end of string
return char gStringNamePtr to -1 of gStringName --last item in the  
string, or empty

else
return char gStringNamePtr to gStringNamePtr +it-1 of gStringName -- 
grab the next item put it+1 into gStringNamePtr --advance the  
pointer to after the delimiter

end if
end nextItemStringName

Of course this way of doing it is not so general, a bit awkward,  
and the function calls would kill a lot of the potential speed.  
That is why a built-in function would be much better. Perhaps a  
syntax something like this:


nextItem(stringName,charOffsetVar)

The variable name specified for the charOffsetVar would have the  
pointer that gets modified.


You could also make it a command something like:

nextThing stringName with charOffsetVar by item

Having sequential access methods like this would allow a much  
greater freedom to process one or more lists at the same time  
without suffering the usual speed penalties.


Dennis


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-28 Thread Dar Scott


On Jun 28, 2005, at 12:20 AM, jbv wrote:


So here's a short reminder of what I had originally in
mind : I only wanted to know if there was a way to
benefit the speed of "repeat for each item i in myVar"
(or "each line" or "each char"...) while reading items
in reverse order...


Looks like I took the word "element" too literally.

Note that with sort, you can supply the sorting expression.  This 
allows a wide range of sorting that you cannot get with the addition of 
a few keywords to repeat.  Once you sort, then you can repeat with the 
fastest method.


Dar

--
**
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
Programming and software
**

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-28 Thread Dennis Brown
What I would like to see is a way to access the next or previous  
"element" in a list independent of the repeat structure.  We have  
something similar in the offset function --offset 
(findString,searchString,skipChars).  The key is to have a concept  
for a pointer of sorts.  The pointer in the offset function is the  
skipChars parameter.  You could just about simulate this capability  
using the offset function (not tested):


global gStringName,gStringNamePtr
function nextItemStringName --don't want to pass the actual strings
get offset(itemDel(), gStringName, gStringNamePtr)
if it = 0 then --delimiter not found, must be end of string
return char gStringNamePtr to -1 of gStringName --last item  
in the string, or empty

else
return char gStringNamePtr to gStringNamePtr +it-1 of  
gStringName --grab the next item
put it+1 into gStringNamePtr --advance the pointer to after  
the delimiter

end if
end nextItemStringName

Of course this way of doing it is not so general, a bit awkward, and  
the function calls would kill a lot of the potential speed.  That is  
why a built-in function would be much better.  Perhaps a syntax  
something like this:


nextItem(stringName,charOffsetVar)

The variable name specified for the charOffsetVar would have the  
pointer that gets modified.


You could also make it a command something like:

nextThing stringName with charOffsetVar by item

Having sequential access methods like this would allow a much greater  
freedom to process one or more lists at the same time without  
suffering the usual speed penalties.


Dennis

On Jun 28, 2005, at 8:08 AM, Robert Brenstein wrote:

When it comes to the 'each element' form, you are right that it is  
ambiguous at first glance, but would seem reasonable that sorting  
applies to the elements themselves since keys are not explicitly  
entering the picture. To get sorting on keys we would need to say


  repeat for each line tKey in the keys of myArray ascending




Oops. My thinking went a bit astray. What you are talking about is  
more like


  repeat for each element foo of fooArray ascending by key of each

Robert
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-28 Thread Robert Brenstein
When it comes to the 'each element' form, you are right that it is 
ambiguous at first glance, but would seem reasonable that sorting 
applies to the elements themselves since keys are not explicitly 
entering the picture. To get sorting on keys we would need to say


  repeat for each line tKey in the keys of myArray ascending



Oops. My thinking went a bit astray. What you are talking about is more like

  repeat for each element foo of fooArray ascending by key of each

Robert
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-28 Thread Robert Brenstein

On Jun 27, 2005, at 1:57 AM, Robert Brenstein wrote:


  repeat for each element x in y descending


Now, is that with keys in descending order or elements in descending order?

Dar


Sorry, Dar, I used element in the loose sense and really meant chunk 
types: char, word, item, line.


When it comes to the 'each element' form, you are right that it is 
ambiguous at first glance, but would seem reasonable that sorting 
applies to the elements themselves since keys are not explicitly 
entering the picture. To get sorting on keys we would need to say


  repeat for each line tKey in the keys of myArray ascending

While we can do sorting explicitly with the sort command, I like the 
idea of having ascending and descending options as a new feature. It 
would combine two steps into a single engine process without a need 
to shuffle sorted results back and forth between engine and our 
program.


Probably, to make it more complete, we would need to include numeric 
and international as options similarly as the sort itself has them.


Now, this has, of course, drifted away from the original request. For 
that one, the syntax could be something like


  repeat for each foo in foofoo down

No sorting involved, simple reversal of direction. Down is the 
closest of the existing keywords for me and already used in another 
form of repeat. And the other poster convinced me that even though it 
would be slower then forwards, it would still likely has enough speed 
benefit.


Robert

PS If this needs to be discussed further, may be we should move it to 
the improve-list. If anyone is filing it in bugzilla, let us know the 
number.

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-27 Thread jbv
Hi guys,

Thanks for spending so much time on my question.

I sent a couple of posts during last week end, but
they never went through...
So here's a short reminder of what I had originally in
mind : I only wanted to know if there was a way to
benefit the speed of "repeat for each item i in myVar"
(or "each line" or "each char"...) while reading items
in reverse order...

It looks that there isn't any built-in Transcript way of
doing this, and a few members including me in my
"disapeared" posts) suggested an improvement to the
"repeat for each" statement in the for of :
repeat for each item i in myVar backwards

"backwards" being an optional parameter that would allow
items to be read in reverse order.

Cheers,
JB

> Wouter,
>
> I was under the impression that JB wanted to read a list sequentially
> in reverse with the repeat for each to make it go faster, not reverse
> the list.  The split into an array is going to be faster at reading
> the list in any order given that the repeat for each in reverse does
> not exist.  However, If we were given a more complete definition of
> the problem, then perhaps the list could have generated a truly
> optimized solution.  For instance, I have had to create some
> solutions for doing stuff in reverse to a list, that I managed to use
> repeat for each loops that ran much faster than splitting.  A genius
> might be able to find all kinds of clever ways to use the existing
> Transcript capabilities, but it would sure be nice if the language
> allowed us mere mortals to tackle a problem in a straight forward way
> without suffering orders of magnitude speed penalties.
>
> As a matter of course, figuring out how to use arrays is one of the
> most straight forward ways to manage data.  Arrays are not the
> fastest nor the most space efficient, but they are usually a
> reasonable compromise for most problems.
>
> I see that our scripting conferences has nothing for arrays in the
> queue.  This might be a good topic based on the number of times it is
> used as a solution for newbie questions.
>
> Dennis
>
> On Jun 27, 2005, at 8:54 PM, Buster wrote:
>
> > Dennis,
> >
> > I thought the original question on this thread was:
> >
> > >
> >
> >> Hi list,
> >>
> >> Is there a way to use
> >> "repeat for each element thisIndexTerm in listOfTerms"
> >> in reverse order, like in
> >> "repeat with i=number of items of myVar down to 1" ?
> >>
> >> Thanks,
> >> JB
> >>
> > >
> >
> > which has changed to a feature request only later on in the thread.
> > This feature request would be nice, but doesn't solve the problem
> > right now.
> > My answer and there you are right, I should have placed it as a
> > reply to JB's original question and not to yours, was only to help
> > out and show some peculiarities of the different solutions
> > proposed, which were:
> >
> > The first method I mentioned (which you called a speed killer) is
> > *not* fast at all when the number of lines exceed a certain level
> > (depending on cpu). And the larger the number of chars in those
> > lines the slower the performance.
> >
> > The second method on the contrary doesn't increase processing time
> > in the same way the first method does and is by far the better
> > solution for larger amounts of lines and chars.
> >
> > Greetings,
> > Wouter
> >
> > On 28 Jun 2005, at 00:51, Wouter wrote:
> >
> >
> >>
> >>
> >> Begin forwarded message:
> >>
> >>
> >>> From: Dennis Brown <[EMAIL PROTECTED]>
> >>> Date: Mon 27 Jun 2005 23:58:13 GMT+02:00
> >>> To: How to use Revolution 
> >>> Subject: Re: "repeat for each" in reverse order ?
> >>> Reply-To: How to use Revolution 
> >>>
> >>>
> >>> Wouter,
> >>>
> >>> I'm not sure what this example has to do with the question on the
> >>> thread, but you first example is a speed killer.  Putting things
> >>> in front of a string causes the whole string to be shuffled to
> >>> make room for the inserted string.  It is a worst case situation
> >>> --although I can always come up with a way to make it slower.  It
> >>> would be faster to use the slower repeat for i=number of lines in
> >>> x down to 1 and then put the lines after like your second example.
> >>>
> >>> Splitting into an array is usually a good approach 

Re: "repeat for each" in reverse order ?

2005-06-27 Thread J. Landman Gay

On 6/27/05 8:22 PM, Dennis Brown wrote:

I see that our scripting conferences has nothing for arrays in the  
queue.  This might be a good topic based on the number of times it is  
used as a solution for newbie questions.


Noted. ;)

--
Jacqueline Landman Gay | [EMAIL PROTECTED]
HyperActive Software   | http://www.hyperactivesw.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-27 Thread Dennis Brown

Wouter,

I was under the impression that JB wanted to read a list sequentially  
in reverse with the repeat for each to make it go faster, not reverse  
the list.  The split into an array is going to be faster at reading  
the list in any order given that the repeat for each in reverse does  
not exist.  However, If we were given a more complete definition of  
the problem, then perhaps the list could have generated a truly  
optimized solution.  For instance, I have had to create some  
solutions for doing stuff in reverse to a list, that I managed to use  
repeat for each loops that ran much faster than splitting.  A genius  
might be able to find all kinds of clever ways to use the existing  
Transcript capabilities, but it would sure be nice if the language  
allowed us mere mortals to tackle a problem in a straight forward way  
without suffering orders of magnitude speed penalties.


As a matter of course, figuring out how to use arrays is one of the  
most straight forward ways to manage data.  Arrays are not the  
fastest nor the most space efficient, but they are usually a  
reasonable compromise for most problems.


I see that our scripting conferences has nothing for arrays in the  
queue.  This might be a good topic based on the number of times it is  
used as a solution for newbie questions.


Dennis

On Jun 27, 2005, at 8:54 PM, Buster wrote:


Dennis,

I thought the original question on this thread was:

>


Hi list,

Is there a way to use
"repeat for each element thisIndexTerm in listOfTerms"
in reverse order, like in
"repeat with i=number of items of myVar down to 1" ?

Thanks,
JB


>

which has changed to a feature request only later on in the thread.
This feature request would be nice, but doesn't solve the problem  
right now.
My answer and there you are right, I should have placed it as a  
reply to JB's original question and not to yours, was only to help  
out and show some peculiarities of the different solutions  
proposed, which were:


The first method I mentioned (which you called a speed killer) is  
*not* fast at all when the number of lines exceed a certain level  
(depending on cpu). And the larger the number of chars in those  
lines the slower the performance.


The second method on the contrary doesn't increase processing time  
in the same way the first method does and is by far the better  
solution for larger amounts of lines and chars.


Greetings,
Wouter

On 28 Jun 2005, at 00:51, Wouter wrote:





Begin forwarded message:



From: Dennis Brown <[EMAIL PROTECTED]>
Date: Mon 27 Jun 2005 23:58:13 GMT+02:00
To: How to use Revolution 
Subject: Re: "repeat for each" in reverse order ?
Reply-To: How to use Revolution 


Wouter,

I'm not sure what this example has to do with the question on the  
thread, but you first example is a speed killer.  Putting things  
in front of a string causes the whole string to be shuffled to  
make room for the inserted string.  It is a worst case situation  
--although I can always come up with a way to make it slower.  It  
would be faster to use the slower repeat for i=number of lines in  
x down to 1 and then put the lines after like your second example.


Splitting into an array is usually a good approach if the repeat  
for each construct will not work.  However, it does take time to  
do the split.  A repeat for each could process the whole string  
in less time than it takes to split it if a repeat for each fits  
the problem.


In your second example, sorting the keys will also take time.   
You might be better off with just a simple repeat for i=number of  
lines in x down to 1 as the array index.  You would have to try  
it on your array to see.


Dennis


On Jun 27, 2005, at 4:24 PM, Wouter wrote:




Hi,

Using the following to reverse the order of lines of a field  
containing 525605  chars in 14194 lines



reversing by:

on mouseUp
  put fld 1 into x
  put the long seconds into zap
  repeat for each line i in x
put i&cr before tList
  end repeat
  put the long seconds - zap
  put tList into fld 1
end mouseUp

takes > 60 seconds on a slowbook (G4 400 mhz)


reversing by:

on mouseUp
  put fld 1 into x
  put the long seconds into zap
  split x by return
  get the keys of x
  sort it numeric descending
  repeat for each line i in it
put x[i]&cr after tList
  end repeat
  put the long seconds - zap
  put tList into fld 1
end mouseUp

yields around 0.413007 seconds on a slowbook (G4 400 mhz)
(which is not too bad)

The amount of chars and lines has a big influence on the speed  
in the first handler,

while in the second handler it has not.

Greetings,
Wouter

On 27 Jun 2005, at 14:40, Dennis Brown wrote:




The repeat for each only goes in forward sequential order  
starting at the beginning, except for arrays where the order is  
indeterminate.


I have requested a sequential access enhancement to allow for  
constructing this type of loop

Re: "repeat for each" in reverse order ?

2005-06-27 Thread Buster

Dennis,

I thought the original question on this thread was:

>

Hi list,

Is there a way to use
"repeat for each element thisIndexTerm in listOfTerms"
in reverse order, like in
"repeat with i=number of items of myVar down to 1" ?

Thanks,
JB

>

which has changed to a feature request only later on in the thread.
This feature request would be nice, but doesn't solve the problem  
right now.
My answer and there you are right, I should have placed it as a reply  
to JB's original question and not to yours, was only to help out and  
show some peculiarities of the different solutions proposed, which were:


The first method I mentioned (which you called a speed killer) is  
*not* fast at all when the number of lines exceed a certain level  
(depending on cpu). And the larger the number of chars in those lines  
the slower the performance.


The second method on the contrary doesn't increase processing time in  
the same way the first method does and is by far the better solution  
for larger amounts of lines and chars.


Greetings,
Wouter

On 28 Jun 2005, at 00:51, Wouter wrote:




Begin forwarded message:


From: Dennis Brown <[EMAIL PROTECTED]>
Date: Mon 27 Jun 2005 23:58:13 GMT+02:00
To: How to use Revolution 
Subject: Re: "repeat for each" in reverse order ?
Reply-To: How to use Revolution 


Wouter,

I'm not sure what this example has to do with the question on the  
thread, but you first example is a speed killer.  Putting things  
in front of a string causes the whole string to be shuffled to  
make room for the inserted string.  It is a worst case situation -- 
although I can always come up with a way to make it slower.  It  
would be faster to use the slower repeat for i=number of lines in  
x down to 1 and then put the lines after like your second example.


Splitting into an array is usually a good approach if the repeat  
for each construct will not work.  However, it does take time to  
do the split.  A repeat for each could process the whole string in  
less time than it takes to split it if a repeat for each fits the  
problem.


In your second example, sorting the keys will also take time.  You  
might be better off with just a simple repeat for i=number of  
lines in x down to 1 as the array index.  You would have to try it  
on your array to see.


Dennis


On Jun 27, 2005, at 4:24 PM, Wouter wrote:



Hi,

Using the following to reverse the order of lines of a field  
containing 525605  chars in 14194 lines



reversing by:

on mouseUp
  put fld 1 into x
  put the long seconds into zap
  repeat for each line i in x
put i&cr before tList
  end repeat
  put the long seconds - zap
  put tList into fld 1
end mouseUp

takes > 60 seconds on a slowbook (G4 400 mhz)


reversing by:

on mouseUp
  put fld 1 into x
  put the long seconds into zap
  split x by return
  get the keys of x
  sort it numeric descending
  repeat for each line i in it
put x[i]&cr after tList
  end repeat
  put the long seconds - zap
  put tList into fld 1
end mouseUp

yields around 0.413007 seconds on a slowbook (G4 400 mhz)
(which is not too bad)

The amount of chars and lines has a big influence on the speed in  
the first handler,

while in the second handler it has not.

Greetings,
Wouter

On 27 Jun 2005, at 14:40, Dennis Brown wrote:



The repeat for each only goes in forward sequential order  
starting at the beginning, except for arrays where the order is  
indeterminate.


I have requested a sequential access enhancement to allow for  
constructing this type of looping in a more flexible way (like  
parallel instantiation, starting at an arbitrary point, and  
reverse order), to make it possible to wander all over your data  
sequentially with the speed of the repeat for each method.   
However, it would be most useful with some improved string  
delimiter handling.  Bugzilla # 2773


Having a reverse order repeat for each might be up to twice as  
slow as the forward version depending on how it is implemented,  
because it has to go backwards to the previous delimiter then  
forward to pick up the data, though it could pick up the data in  
reverse order on the way back.  However, even twice as slow  
would be much faster than any other method.


Dennis


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-27 Thread Dennis Brown

Wouter,

I'm not sure what this example has to do with the question on the  
thread, but you first example is a speed killer.  Putting things in  
front of a string causes the whole string to be shuffled to make room  
for the inserted string.  It is a worst case situation --although I  
can always come up with a way to make it slower.  It would be faster  
to use the slower repeat for i=number of lines in x down to 1 and  
then put the lines after like your second example.


Splitting into an array is usually a good approach if the repeat for  
each construct will not work.  However, it does take time to do the  
split.  A repeat for each could process the whole string in less time  
than it takes to split it if a repeat for each fits the problem.


In your second example, sorting the keys will also take time.  You  
might be better off with just a simple repeat for i=number of lines  
in x down to 1 as the array index.  You would have to try it on your  
array to see.


Dennis


On Jun 27, 2005, at 4:24 PM, Wouter wrote:


Hi,

Using the following to reverse the order of lines of a field  
containing 525605  chars in 14194 lines



reversing by:

on mouseUp
  put fld 1 into x
  put the long seconds into zap
  repeat for each line i in x
put i&cr before tList
  end repeat
  put the long seconds - zap
  put tList into fld 1
end mouseUp

takes > 60 seconds on a slowbook (G4 400 mhz)


reversing by:

on mouseUp
  put fld 1 into x
  put the long seconds into zap
  split x by return
  get the keys of x
  sort it numeric descending
  repeat for each line i in it
put x[i]&cr after tList
  end repeat
  put the long seconds - zap
  put tList into fld 1
end mouseUp

yields around 0.413007 seconds on a slowbook (G4 400 mhz)
(which is not too bad)

The amount of chars and lines has a big influence on the speed in  
the first handler,

while in the second handler it has not.

Greetings,
Wouter

On 27 Jun 2005, at 14:40, Dennis Brown wrote:


The repeat for each only goes in forward sequential order starting  
at the beginning, except for arrays where the order is indeterminate.


I have requested a sequential access enhancement to allow for  
constructing this type of looping in a more flexible way (like  
parallel instantiation, starting at an arbitrary point, and  
reverse order), to make it possible to wander all over your data  
sequentially with the speed of the repeat for each method.   
However, it would be most useful with some improved string  
delimiter handling.  Bugzilla # 2773


Having a reverse order repeat for each might be up to twice as  
slow as the forward version depending on how it is implemented,  
because it has to go backwards to the previous delimiter then  
forward to pick up the data, though it could pick up the data in  
reverse order on the way back.  However, even twice as slow would  
be much faster than any other method.


Dennis


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-27 Thread Wouter

Hi,

Using the following to reverse the order of lines of a field  
containing 525605  chars in 14194 lines



reversing by:

on mouseUp
  put fld 1 into x
  put the long seconds into zap
  repeat for each line i in x
put i&cr before tList
  end repeat
  put the long seconds - zap
  put tList into fld 1
end mouseUp

takes > 60 seconds on a slowbook (G4 400 mhz)


reversing by:

on mouseUp
  put fld 1 into x
  put the long seconds into zap
  split x by return
  get the keys of x
  sort it numeric descending
  repeat for each line i in it
put x[i]&cr after tList
  end repeat
  put the long seconds - zap
  put tList into fld 1
end mouseUp

yields around 0.413007 seconds on a slowbook (G4 400 mhz)
(which is not too bad)

The amount of chars and lines has a big influence on the speed in the  
first handler,

while in the second handler it has not.

Greetings,
Wouter

On 27 Jun 2005, at 14:40, Dennis Brown wrote:

The repeat for each only goes in forward sequential order starting  
at the beginning, except for arrays where the order is indeterminate.


I have requested a sequential access enhancement to allow for  
constructing this type of looping in a more flexible way (like  
parallel instantiation, starting at an arbitrary point, and reverse  
order), to make it possible to wander all over your data  
sequentially with the speed of the repeat for each method.   
However, it would be most useful with some improved string  
delimiter handling.  Bugzilla # 2773


Having a reverse order repeat for each might be up to twice as slow  
as the forward version depending on how it is implemented, because  
it has to go backwards to the previous delimiter then forward to  
pick up the data, though it could pick up the data in reverse order  
on the way back.  However, even twice as slow would be much faster  
than any other method.


Dennis

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-27 Thread Dar Scott


On Jun 27, 2005, at 1:57 AM, Robert Brenstein wrote:


  repeat for each element x in y descending


Now, is that with keys in descending order or elements in descending 
order?


Dar
--
**
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
Programming and software
**

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-27 Thread Dennis Brown
The repeat for each only goes in forward sequential order starting at  
the beginning, except for arrays where the order is indeterminate.


I have requested a sequential access enhancement to allow for  
constructing this type of looping in a more flexible way (like  
parallel instantiation, starting at an arbitrary point, and reverse  
order), to make it possible to wander all over your data sequentially  
with the speed of the repeat for each method.  However, it would be  
most useful with some improved string delimiter handling.  Bugzilla #  
2773


Having a reverse order repeat for each might be up to twice as slow  
as the forward version depending on how it is implemented, because it  
has to go backwards to the previous delimiter then forward to pick up  
the data, though it could pick up the data in reverse order on the  
way back.  However, even twice as slow would be much faster than any  
other method.


Dennis

On Jun 27, 2005, at 3:57 AM, Robert Brenstein wrote:

It sounds like you're looking for a feature that doesn't yet exist  
(or at least I'm not aware of it). I could see having a property  
that defines the direction in which the 'repeat for each'  
structure does its looping, like this:


  set the repeatDirection to "descending" -- or "down",  
"reverse", ???

  repeat for each element x in y
-- actions
  end repeat

That would be a nice feature indeed. No harm in requesting it!

Phil Davis



I would prefer

  repeat for each element x in y descending

but I doubt whether this would have the performance anywhere close  
to ascending 'for each' so it is probably pointless to have it. As  
far as I know, the speed of 'repeat for each' comes from processing  
elements sequentially and thus without having to recalculate the  
list pointer position.


Robert
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-27 Thread Robert Brenstein
It sounds like you're looking for a feature that doesn't yet exist 
(or at least I'm not aware of it). I could see having a property 
that defines the direction in which the 'repeat for each' structure 
does its looping, like this:


  set the repeatDirection to "descending" -- or "down", "reverse", ???
  repeat for each element x in y
-- actions
  end repeat

That would be a nice feature indeed. No harm in requesting it!

Phil Davis


I would prefer

  repeat for each element x in y descending

but I doubt whether this would have the performance anywhere close to 
ascending 'for each' so it is probably pointless to have it. As far 
as I know, the speed of 'repeat for each' comes from processing 
elements sequentially and thus without having to recalculate the list 
pointer position.


Robert
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-26 Thread Thomas McGrath III

You can also do


repeat with i = (the num of items in myVar) down to 1
-- do something
end repeat

Tom


On Jun 26, 2005, at 7:06 PM, Thomas McCarthy wrote:



I'm pretty sure you can do it--because I do it (and I'm not a guru)
Here's what I do:

put the num of items in myVariable into tnum --or lines, or words,or..
repeat with i = tnum down to 1
do something with item i of myVariable
--drink coffee
end repeat


___
Join Excite! - http://www.excite.com
The most personalized portal on the Web!


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution




Thomas J. McGrath III
SCS
1000 Killarney Dr.
Pittsburgh, PA 15234
412-885-8541

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-26 Thread Thomas McCarthy

I'm pretty sure you can do it--because I do it (and I'm not a guru)
Here's what I do:

put the num of items in myVariable into tnum --or lines, or words,or..
repeat with i = tnum down to 1
do something with item i of myVariable
--drink coffee
end repeat


___
Join Excite! - http://www.excite.com
The most personalized portal on the Web!


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-26 Thread Dennis Brown

JB,

The repeat for each only goes in forward sequential order starting at  
the beginning, except for arrays where the order is indeterminate.


I have requested a sequential access enhancement to allow for  
constructing this type of looping in a more flexible way (like  
parallel instantiation, starting at an arbitrary point, and reverse  
order), to make it possible to wander all over your data sequentially  
with the speed of the repeat for each method.  However, it would be  
most useful with some improved string delimiter handling.  Bugzilla #  
2773


Dennis

On Jun 25, 2005, at 5:04 AM, jbv wrote:





Hi list,

Is there a way to use
"repeat for each element thisIndexTerm in listOfTerms"
in reverse order, like in
"repeat with i=number of items of myVar down to 1" ?

Thanks,
JB

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution









___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-26 Thread Dar Scott


On Jun 25, 2005, at 3:04 AM, jbv wrote:


Is there a way to use
"repeat for each element thisIndexTerm in listOfTerms"
in reverse order, like in
"repeat with i=number of items of myVar down to 1" ?


I don't think there is an order in 'repeat for each element'.  I think 
the elements are processed in some seemingly arbitrary order.  In any 
case...


You can get the keys of the array and sort them in the order you want 
and then loop through the keys with 'repeat for each line'.


Dar

--
**
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
Programming and software
**

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-26 Thread Mark Smith

How about

put the keys of myArray into kList
 repeat for each line L in kList
  put cr & L before newKlist
 end repeat
delete char 1 of newKlist

 repeat for each line L in newKlist
   --doStuff
end repeat

It's two loops, admittedly, but unless it's a very big array, it'd be 
really quick.
You could also put the first loop into a separate function if you need 
to do this in many different places in your code.



Cheers,

Mark Smith


On 25 Jun 2005, at 18:57, Phil Davis wrote:

It sounds like you're looking for a feature that doesn't yet exist (or 
at least I'm not aware of it). I could see having a property that 
defines the direction in which the 'repeat for each' structure does 
its looping, like this:


  set the repeatDirection to "descending" -- or "down", "reverse", ???
  repeat for each element x in y
-- actions
  end repeat

That would be a nice feature indeed. No harm in requesting it!

Phil Davis



jbv wrote:

Hi list,
Is there a way to use
"repeat for each element thisIndexTerm in listOfTerms"
in reverse order, like in
"repeat with i=number of items of myVar down to 1" ?
Thanks,
JB
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: "repeat for each" in reverse order ?

2005-06-26 Thread Phil Davis
It sounds like you're looking for a feature that doesn't yet exist (or 
at least I'm not aware of it). I could see having a property that 
defines the direction in which the 'repeat for each' structure does its 
looping, like this:


  set the repeatDirection to "descending" -- or "down", "reverse", ???
  repeat for each element x in y
-- actions
  end repeat

That would be a nice feature indeed. No harm in requesting it!

Phil Davis



jbv wrote:

Hi list,

Is there a way to use
"repeat for each element thisIndexTerm in listOfTerms"
in reverse order, like in
"repeat with i=number of items of myVar down to 1" ?

Thanks,
JB

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: "repeat for each" in reverse order ?

2005-06-25 Thread Jim Bufalini
JB

put the number of [whatever] into j   -- See note:
repeat with i = j down to 1

If you put the first line in the loop as in "i = the number of [whatever]
down to 1" the number of would be evaluated each time, I believe, and be
slower.

Jim

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of jbv
Sent: Friday, June 24, 2005 11:05 PM
To: How to use Revolution
Subject: "repeat for each" in reverse order ?


Hi list,

Is there a way to use
"repeat for each element thisIndexTerm in listOfTerms"
in reverse order, like in
"repeat with i=number of items of myVar down to 1" ?

Thanks,
JB

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: "repeat for each" in reverse order ?

2005-06-25 Thread MisterX
sort your items to list backwards first ;) 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of jbv
> Sent: Saturday, June 25, 2005 11:05
> To: How to use Revolution
> Subject: "repeat for each" in reverse order ?
> 
> Hi list,
> 
> Is there a way to use
> "repeat for each element thisIndexTerm in listOfTerms"
> in reverse order, like in
> "repeat with i=number of items of myVar down to 1" ?
> 
> Thanks,
> JB
> 
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage 
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


"repeat for each" in reverse order ?

2005-06-25 Thread jbv
Hi list,

Is there a way to use
"repeat for each element thisIndexTerm in listOfTerms"
in reverse order, like in
"repeat with i=number of items of myVar down to 1" ?

Thanks,
JB

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution