Seems impossible to do it with foldr