filter using foldl
map foldl