Created
October 30, 2011 14:30
-
-
Save fumieval/1325960 to your computer and use it in GitHub Desktop.
2つ以上の引数を持つ関数の合成
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
f :: Int -> Bool | |
f x = even x | |
f' :: (a -> Int) -> (a -> Bool) | |
f' = (f.) -- (.) :: (β→γ)→(α→β)→(α→γ) αにa、βにInt、γにBoolが当てはまる。 | |
f'' :: (b -> (a -> Int)) -> (b -> (a -> Bool)) | |
f'' = ((f.).) -- (.) :: (β'→γ')→(α'→β')→(α'→γ') α' に b、 β' に a->Int 、 γ'に a->Bool が当てはまる。 | |
g = length :: [d] -> Int | |
g' = (sum.).filter :: (Int -> Bool) -> [Int] -> Int | |
g'' = (((sum).).).zipWith :: (j -> k -> Int) -> [j] -> [k] -> Int | |
fg = f . g :: [d] -> Bool | |
fg' = f' . g' :: (Int -> Bool) -> [Int] -> Bool | |
fg'' = f'' . g'' :: (j -> k -> Int) -> [j] -> [k] -> Bool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment