Kotlin / kotlin-koans

Kotlin workshop
MIT License
2.6k stars 1.41k forks source link

Lambdas Intro is Hard to Understand #100

Closed npc-adrian closed 7 years ago

npc-adrian commented 7 years ago

Maybe I'm missing something obvious but how should I infer from these tests that task4() should check if any item in the collections is a multiple of 42 as per the solution in the resolutions branch?

class _04_Lambdas() {
    @Test fun contains() {
        assertTrue(task4(listOf(1, 2, 3, 126, 555)))
    }

    @Test fun notContains() {
        assertFalse(task4(listOf(44)))
    }
}

Would it make sense to rename the tests to something like containsAMultipleOf42() and doesNotContainAMultipleOf42()

svtk commented 7 years ago

There was "Rewrite JavaCode4.task4() in Kotlin using lambdas." with element % 42 == 0;. I replaced 42 with 2 and modified the task description to avoid confusion.