Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (19 sloc) 660 Bytes

Any callback

Nice to solve before

Instructions

Given list of integers and callback implement a recursive function which returns true if simple value in the list passed to callback returns true, otherwise return false.

Puzzle | Solution

Examples

Example 1

val callback:((Int) -> Boolean) = { it > 3 }
anyCallback(listOf(1, 2, 3, 4), callback) shouldEqual true

Example 2

val callback:((Int) -> Boolean) = { it > 3 }
anyCallback(listOf(1, 2, 3), callback) shouldEqual false
You can’t perform that action at this time.