Created
January 18, 2017 03:24
-
-
Save appleshan/15252bbec0035ecf5ecca678cb7e23fd 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
Haskell在数学问题上非常有表现力,有所有编程语言都羡慕不来的List comprehension, | |
比如:一个小学一年级的数学题:“大白 + 大白 = 白胖胖,求大、白、胖分别是哪3个数字”: | |
Haskell描述: | |
Prelude> [(大, 白, 胖)| 大 <- [1..9], 白 <- [1..9], 胖 <- [0..9], 大*10+白+大*10+白 == 白*100+胖*10+胖] | |
[(6,1,2)] | |
Prelude> 61+61 == 122 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment