Created
March 4, 2020 13:03
-
-
Save Riduidel/e0dbd53f0a233b790b6057bbd53568ab to your computer and use it in GitHub Desktop.
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
fizzbuzz::Int->String | |
fizzbuzz n | (mod n 3)==0 && (mod n 5)==0 = "FizzBuzz" | |
| (mod n 3)==0 = "Fizz" | |
| (mod n 5)==0 = "Buzz" | |
| otherwise = show n | |
main = do | |
print $"3="++(fizzbuzz 3) | |
print $"4="++(fizzbuzz 4) | |
print $"5="++(fizzbuzz 5) | |
print $"6="++(fizzbuzz 6) | |
print $"10="++(fizzbuzz 10) | |
print $"15="++(fizzbuzz 15) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
J'aimerais une explication du
show
c'est une fonction qui prend un paramètre et le transforme en String (et donc comme il ne voulais pas faire comme tout le monde l'ont appelé show au lieu de str ou toString) ou autre chose de plus subtile ?