Multiple arguments with the filter command

Mark Smith mark at maseurope.net
Wed Oct 25 16:31:04 EDT 2006


I'd think the only 'danger'  in the brute force approach is that if  
vContainer were very big, and there were many items in vInputStrings,  
it would probably be slow due to the sheer amount of copying going on.

If that were the case, then maybe iterating over the lines of  
vContainer might be more efficient, since large chunks of data would  
not be copied.

  repeat for each line thisLine in vContainer
     repeat for each item thisItem in vInputStrings
       get thisLine
       filter it without ("*!*" & thisItem & "*!*")
       if it is not empty then
         put it & cr after vNewContainer
         exit repeat -- no need for further tests on thisLine
       end if
     end repeat
   end repeat

This is not tested,  might be even slower!

Best,

Mark

On 25 Oct 2006, at 21:54, Mark Powell wrote:

> Thanks to both Jim and Marielle for their awesome feedback.   
> Instead of
> asking specific questions about the details of your feedback, I  
> want to
> ask a general performance question.  The filter does work within a
> repeat loop like this:
>
> repeat for each item thisItem in vInputStrings
>   get vContainer
>   filter it with ("*!*" & thisItem & "*!*")
>   put cr & it after vNewContainer
> end repeat
> ...do something with vNewContainer
>
> But given that vInputStrings could be very large, my concern is  
> that the
> getting and putting involved would be dangerously memory- or
> processor-intensive.  What are the risks you have seen with the brute
> force approach like the one above?
>
> Mark
>
>
> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Mark
> Powell
> Sent: Wednesday, October 25, 2006 10:04 AM
> To: use-revolution at lists.runrev.com
> Subject: Multiple arguments with the filter command
>
> Another text filtering question, please.  I have studied the archives
> but have not found precisely the solution that works.
>
> I have a container vContainer of file names, each line of the form
>
>   <directory>/!?!<filename>!/<filesize>/<creationdate>
>
> Here are three literal examples:
>
>   C:/The World/Asia/!?!prologue.ps!/1026/1115309596
>   C:/The World/Europe/!?!Map of Europe.jpg!/3536844/1155845730
>   C:/The World/!?!About1953.txt!/4288/1161776573
>
> User-input text strings can define what files from vContainer are  
> to be
> retained. The following works to filter-in the first example above:
>
>   filter vContainer with ("*!*.ps*!*")
>
> However, if the user wants both ".ps" and "Europe" to be retained, how
> best to do it without repeat loops and a lot of temporary copies of
> vContainer?  Is there a way?
>
> One catch is that if the user inputs something like "53", the  
> operation
> must recognize the fact that the "53" in the first two examples is  
> not a
> part of the file name, thereby filtering them out, but that "53" is a
> part of the file name in the third example, thereby filtering it in.
> This is one reason for the exclamation point tokens in vContainer.
>
> Any ideas greatly appreciated.
>
> Mark Powell
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the Use-livecode mailing list