Skip to content

Instantly share code, notes, and snippets.

@Krasnyanskiy
Last active April 16, 2016 19:25
Show Gist options
  • Save Krasnyanskiy/75d4e1170493e58b40858a91767bc5c8 to your computer and use it in GitHub Desktop.
Save Krasnyanskiy/75d4e1170493e58b40858a91767bc5c8 to your computer and use it in GitHub Desktop.
-scala: ?
object Test {
def main(args: Array[String]) {
val result = `iterate'`(3, `^2`, 5)
println(s"$result")
}
def `iterate'`(n: Int, f: Int => Int, x: Int): Int = n match {
case 0 => x
case _ => `iterate'`(n - 1, f, f(x))
}
def `^2`(x: Int) = x * x
}
@Krasnyanskiy
Copy link
Author

A bug with stroke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment