User Tools

Site Tools


codesnippets:equivalentfunctioncompositions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
codesnippets:equivalentfunctioncompositions [2021/05/01 17:28] – created f2b216codesnippets: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: ''f1 (f2 . f3)'' equals ''(f1 . (f2 . )) f3'' 
-    * code:<code Haskell>+    * example code:<code Haskell>
 main :: IO () main :: IO ()
 main =  main = 
     do     do
-        print $ f f1 f2 f3 6.4 +        print $ f f1f2f36.4 
-        print $ f' f1 f2 f3 6.4 +        print $ f' f1f2f36.4 
-        print $ f'' f1 f2 f3 6.4+        print $ f'' f1f2f36.4
  
 f :: ((Integer -> String) -> Double -> [String]) -> (Int -> String) -> (Integer -> Int) ->  Double -> [String] f :: ((Integer -> String) -> Double -> [String]) -> (Int -> String) -> (Integer -> Int) ->  Double -> [String]
-f f1f2f3x' = f1(f2. f3') x'+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' f1f2f3= f1(f2. f3')+f' f1 f2 f3 = f1 (f2 . f3)
  
 f'' :: ((Integer -> String) -> Double -> [String]) -> (Int -> String) -> (Integer -> Int) ->  Double -> [String] f'' :: ((Integer -> String) -> Double -> [String]) -> (Int -> String) -> (Integer -> Int) ->  Double -> [String]
-f'' f1f2= f1. (f2. )+f'' f1 f2 f3 (f1 . (f2 . )) f3
  
-f1 :: (Integer -> String) -> Double -> [String] -- (a -> c) -> x -> r +f1:: (Integer -> String) -> Double -> [String] -- (a -> c) -> x -> r 
-f1 fx nd = [(fx (floor nd))] +f1fx nd = [(fx (floor nd))] 
-f2 :: (Int -> String) -- (b -> c) +f2:: (Int -> String) -- (b -> c) 
-f2 n = replicate n 'x' +f2n = replicate n 'x' 
-f3 :: (Integer -> Int) -- (a -> b) +f3:: (Integer -> Int) -- (a -> b) 
-f3 n = fromIntegral n+f3n = fromIntegral n
 </code> </code>
 +
 +
 +===== ✎ =====
 +~~DISCUSSION~~
codesnippets/equivalentfunctioncompositions.1619882937.txt.gz · Last modified: (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki