I thought there was a built in method for determining whether all / any members of a list satisfied a predicate test, but searching the documentation for lists, as well as searching the index for any of the keywords (at least those I could think of) didn't turn up anything.
I wrote a function that basically achieves this:
/* true_false allows one to specify whether to check for any "true" results or any "false" results */
any_list_member(aList, predicate_test, true_false):=
block(
[ aList:aList,
predicate_test:predicate_test,
true_false:true_false,
length_of_aList:length(aList),
predicate_test_results
],
predicate_test_results:map('predicate_test, aList),
if member(true_false, predicate_test_results)
then true
else false
);
but generally prefer to rely on native Maxima scripts, as I don't have much experience programming, so work with the assumption that official scripts will be much more robust than my own :)
Is there a built in method for achieving this? If not, any suggestions for improved implementation are welcome and appreciated.