tuned grep lambda to call object.get(k) only once