Thank you very much everyone. I need to go and practice more with pattern matching. I can see it's very powerful, but I haven't properly understood it up to now.
You can use a pure function in DeleteCases if it is packaged as a PatternTest:
DeleteCases
PatternTest
DeleteCases[{{1, 2}, Range[21]}, _?(Length[#] < 20 &)]
Andy,
You need a Pattern in DeleteCases while Select uses a function that returns true/false. An example would be
DeleteCases[list, (x_ /; Length[x] < 20)]
Regards,
Neil
Andy:
I'm not at a place where I can try anything right now. But, let me give this my best guess.
I think the answer might be yes, but the function would have to return a pattern. Your example returns true/false.