modify for-loop by lambda