apply f to list hangs function



On June 29, 2011, Edwin Woollett wrote:
--------------
>Use of apply ('search_file, alist) hangs the
>run of my function search_mfiles (file-or-direc-path,substring, options ),
>which uses search_file(file,substring,options) and ls (path).
----------------
I found obscure error inside search_file, which had the lines
;;;        %lines : read_text (%fname),
;;;        if not  %lines  then return (false),

which resulted in the hangup of Maxima in the context described.
By changing the lines to

;;;;      %lines : read_text (%fname),
;;;;      if %lines = false then return (false),

the hangup went away with typical results:
--------------------------------------------
(%i1) display2d:false$
(%i2) load(search_mfiles);
(%o2) "c:/work2/search_mfiles.mac"
(%i3) search_mfiles (  "c:/work2/temp1/",  "is"  );

c:/work2/temp1/atext1.txt
 2  Is this line two? Yes, this is line two.
 6  This is line six, Isn't it?

c:/work2/temp1/atext2.txt
 2  Is this line two? Yes, this is line two.
 6  This is line six, Isn't it?

c:/work2/temp1/calc1news.txt
 9  The organization of chapter six is then:
 96  The Maxima output is the list of the vector curl components in the
 98   a reminder to the user of what the current coordinate system is
 102  Thus the syntax is based on lists and is similar to (although better
 105  There is a separate function to change the current coordinate system.
 112    plotderiv(..) which is useful for "automating" the plotting

c:/work2/temp1/ndata1.dat
 1  The calculation of the effective cross section is much simplified if 
only
 3  those collisions are considered for which the impact parameter is large, 
so
 5  that the field U is weak and the angles of deflection are small. The

c:/work2/temp1/stavros-tricks.txt
 34  Not a bug, but Maxima doesn't know that the beta function is symmetric:

c:/work2/temp1/text1.txt
 1  is this line one? Yes, this is line one.
 3  Here is line three.
 5  This is line five, isn't it?

c:/work2/temp1/trigsimplification.txt
 13  (1) Is there a Maxima command that indicates whether expr is a product 
of
 76  > (1) Is there a Maxima command that indicates whether expr is a 
product of
 91  Well, that is inherent in their definition.  Trigreduce replaces all
 94  is sin(x)*cos(x), since the individual terms are not products of trigs.
 95  There is no built-in function which tries to find the smallest 
expression,
 151  is better. If the user wants to expand the contents of sin to discover
 153  is right that Maxima avoids potentially very expensive operations in

c:/work2/temp1/wu-d.txt
 1  As a dedicated windows xp user who is delighted to have windows binaries
 3  all who are considering windows use that there is no problem with 
keeping previous

(%o3) done
-----------------------------------
I am experimenting with using these functions to search the Maxima lisp 
source code
from inside a Maxima session.

Ted Woollett