implement generic all & any operations