redefine filter, map and append using foldRight