Created
April 25, 2018 17:17
-
-
Save FlorianCassayre/ed4fa5666cc284e027a4d4d6121704e4 to your computer and use it in GitHub Desktop.
Soit f(_) une fonction...
This file contains 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
val f: Double => Double = x => x * x // Une fonction, peu importe | |
println(f(_)) // Il s'agit bien d'une fonction (anonyme) | |
val g: Double => Double = f(_) // On peut vérifier qu'elle typecheck | |
// On peut lui appliquer des valeurs normalement (ne pas oublier les parenthèses !) | |
println((f(_))(3)) // Affiche 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment