If dir accepted a filter parameter (a predicate function) then it would be easier to filter out specific file types (e.g. files with a mode of 'file', files created in the last N days) without having to resort to additional nesting within the generic for.
(One particularly notable use of such a feature would be to filter out '..' and '.' as they often aren't relevant.)
If
dir
accepted afilter
parameter (a predicate function) then it would be easier to filter out specific file types (e.g. files with amode
of'file'
, files created in the last N days) without having to resort to additional nesting within the genericfor
.(One particularly notable use of such a feature would be to filter out
'..'
and'.'
as they often aren't relevant.)