Skip to content

Instantly share code, notes, and snippets.

@siosio
Created June 6, 2012 04:24
Show Gist options
  • Save siosio/2879930 to your computer and use it in GitHub Desktop.
Save siosio/2879930 to your computer and use it in GitHub Desktop.
fun main(args: Array<String>) {
println (30.buzzbuzz().toList())
}
fun Int.buzzbuzz(): java.util.Iterator<Int> {
var buzz = #(0, 0)
fun Int.range(size:Int) = (this + 1 .. this + size)
fun buzzer() = {
if (buzz._1 >= this) {
null
} else {
buzz = #(buzz._1 + 1, buzz._2.range(15).find {it % 3 != 0 && it % 5 == 0}.sure())
buzz._2
}
}
return iterate<Int>(buzzer())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment