codesnippets:equivalentfunctioncompositions
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| codesnippets:equivalentfunctioncompositions [2021/05/01 17:28] – created f2b216 | codesnippets:equivalentfunctioncompositions [2025/10/08 00:48] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Equivalent function compositions ====== | ====== Equivalent function compositions ====== | ||
| - | * example | + | * assertion: '' |
| - | * code:< | + | * example |
| main :: IO () | main :: IO () | ||
| main = | main = | ||
| do | do | ||
| - | print $ f f1 f2 f3 6.4 | + | print $ f f1' |
| - | print $ f' f1 f2 f3 6.4 | + | print $ f' f1' |
| - | print $ f'' | + | print $ f'' |
| f :: ((Integer -> String) -> Double -> [String]) -> (Int -> String) -> (Integer -> Int) -> Double -> [String] | f :: ((Integer -> String) -> Double -> [String]) -> (Int -> String) -> (Integer -> Int) -> Double -> [String] | ||
| - | f f1' | + | f f1 f2 f3 x' = f1 (f2 . f3) x' |
| f' :: ((Integer -> String) -> Double -> [String]) -> (Int -> String) -> (Integer -> Int) -> Double -> [String] | f' :: ((Integer -> String) -> Double -> [String]) -> (Int -> String) -> (Integer -> Int) -> Double -> [String] | ||
| - | f' f1' | + | f' f1 f2 f3 = f1 (f2 . f3) |
| f'' | f'' | ||
| - | f'' | + | f'' |
| - | f1 :: (Integer -> String) -> Double -> [String] -- (a -> c) -> x -> r | + | f1' |
| - | f1 fx nd = [(fx (floor nd))] | + | f1' |
| - | f2 :: (Int -> String) -- (b -> c) | + | f2' |
| - | f2 n = replicate n ' | + | f2' |
| - | f3 :: (Integer -> Int) -- (a -> b) | + | f3' |
| - | f3 n = fromIntegral n | + | f3' |
| </ | </ | ||
| + | |||
| + | |||
| + | ===== ✎ ===== | ||
| + | ~~DISCUSSION~~ | ||
codesnippets/equivalentfunctioncompositions.1619882937.txt.gz · Last modified: (external edit)
