use lambda with for_each.