Last active
April 16, 2016 19:25
-
-
Save Krasnyanskiy/75d4e1170493e58b40858a91767bc5c8 to your computer and use it in GitHub Desktop.
-scala: ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A bug with stroke.