Created
February 25, 2014 14:52
-
-
Save taiki45/9210318 to your computer and use it in GitHub Desktop.
非決定計算で便利なリストモナドの性質
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
expects = do n1 <- [0..1] | |
n2 <- [0..1] | |
n3 <- [0..1] | |
n4 <- [0..1] | |
n5 <- [0..1] | |
return [n1, n2, n3, n4, n5] | |
expects' = sequence $ replicate 5 [0..1] | |
-- expects == expects' = True | |
-- [[0,0,0,0,0],[0,0,0,0,1],[0,0,0,1,0],[0,0,0,1,1],[0,0,1,0,0],[0,0,1,0,1],[0,0,1,1,0],[0,0,1,1,1],[0,1,0,0,0],[0,1,0,0,1],[0,1,0,1,0],[0,1,0,1,1],[0,1,1,0,0],[0,1,1,0,1],[0,1,1,1,0],[0,1,1,1,1],[1,0,0,0,0],[1,0,0,0,1],[1,0,0,1,0],[1,0,0,1,1],[1,0,1,0,0],[1,0,1,0,1],[1,0,1,1,0],[1,0,1,1,1],[1,1,0,0,0],[1,1,0,0,1],[1,1,0,1,0],[1,1,0,1,1],[1,1,1,0,0],[1,1,1,0,1],[1,1,1,1,0],[1,1,1,1,1]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment