Page 2 of 2
Re: Dynamically Change Input Variable - Can We...?
Posted: 22 Jun 2015 10:36
by SkyFrontier
exists() verification can take time, so I prefer they are all treated as files, ie, wiped away right from start.
Re: Dynamically Change Input Variable - Can We...?
Posted: 22 Jun 2015 11:16
by PeterH
SkyFrontier wrote:Hi, Peter.
In case I'm trying to improve the general speed of script execution. The loop is used because I need to check a huge list of input ($a), reducing it to a minimum common value, thus allowing the magic.
The actual case is described here:
http://www.xyplorer.com/xyfc/viewtopic. ... 60#p125367 , and this is an idea I had to solve it.
Feel free to contribute there, too, if you'd like to.
(now I'll finally study the suggested methods)

Hm - what to say?
(Sorry: restricted time to think about the original case...)
But you said: "I need to check a huge list of input ($a), reducing it to a minimum common value"
So
- either directly loop on $a with e.g. ForEach - but don't change $a, but a copy $a2
- or do what I think others said: manually loop by While, until "all is done" - here you can change $a *if* you re-calculate all needed index variables *to* $a. Or also create $a2.
In both cases $a2
- either can be a copy of $a, where the changes are applied to, or
- be started empty, and dynamically be expanded while examining $a
It seems I'd loop by ForEach (i.e. entry by entry), dynamically creating and expanding $a2
And sorry to say: years ago I said "I will never learn regular expressions". I think it's good this way
(It doesn't seem to work the way I am thinking

)
Re: Dynamically Change Input Variable - Can We...?
Posted: 25 Jun 2015 18:23
by SkyFrontier
Thanks for the input, Peter.
In fact the closest I got for a solution was the old while loop trick, but then I stuck at the regex thing. Yeah, I know the feeling (probably not for the same reason as you): two times I researched on regex but soon I quit learning it due to time constraints, plus for seeing it... regex. >sigh<
Once I asked here for an XY approach to automation for regex construction, now I have at least one reason to believe that would not be possible: even regexMagic, an apparently easy solution for regex building, is complicated to use (I just needed a demo video to realize I would have to take a quite steep learning curve for just learning how to operate it).
highend (once again!) was very helpful in finding a solution with me - a first test with a ~3k items list was processed in no time. Perfection! Thank you, highend!