%mathpiper,def="ListHasFunc"

/// ListHasFunc --- test for one of the elements of a list to contain a function
/// this is mainly useful to test whether a list has nested lists, 
/// i.e. ListHasFunc({1,2,3}, List)=False and ListHasFunc({1,2,{3}}, List)=True.
// need to exclude the List atom itself, so don't use FunctionToList
19 # ListHasFunc({}, _atom) <-- False;
20 # ListHasFunc(expr_IsList, atom_IsAtom) <-- HasFunc(First(expr), atom) Or ListHasFunc(Rest(expr), atom);

%/mathpiper




%mathpiper_docs,name="ListHasFunc",categories="User Functions;Predicates"
*CMD ListHasFunc --- test for one of the elements of a list to contain a function
*STD
*CALL
	ListHasFunc( list, func )

*PARMS

{list} - a list of expressions

{func} - a function atom to be found

*DESC

Given a list of expressions and and a function name, this command returns 
{True} if the list contains the function name.

*E.G.
In> lst := {Ln(x),Sinh(a*x),ArcTan(3/x)}
Result: {Ln(x),Sinh(a*x),ArcTan(3/x)}

In> ListHasFunc(lst,Sqrt)
Result: False

In> ListHasFunc(lst,Ln)
Result: True

In> ListHasFunc(lst,Sinh)
Result: True

In> ListHasFunc(lst,ArcTan)
Result: True
*SEE HasFunc
%/mathpiper_docs


