Created
September 2, 2015 12:33
-
-
Save shigemk2/536f73dd9097b7d182dc 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
type Birds = Int | |
type Pole = (Birds, Birds) | |
-- 鳥 | |
landLeft :: Birds -> Pole -> Pole | |
landLeft n (left, right) = (left + n, right) | |
landRight :: Birds -> Pole -> Pole | |
landRight n (left, right) = (left, right + n) | |
-- バランス棒 | |
x -: f = f x | |
main = do | |
print $ landLeft 2 (0, 0) | |
print $ landLeft 1 (1, 2) | |
print $ landRight (-1) (1, 2) | |
print $ (0, 0) -: landLeft 1 -: landRight 1 -: landLeft 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment