passing a lambda to each