New code

main
Aleksey Zubakov 2 years ago
parent 3e886a6c0c
commit 8382832f42
  1. 12
      07/Main.hs
  2. 28
      07/Second.hs

@ -20,6 +20,18 @@ int_plus_3 n = n + 3
-- examples -- examples
comp :: BigP -> Integer comp :: BigP -> Integer
comp = int_plus_3 . bar comp = int_plus_3 . bar
-- same as: int_plus_3 $ bar $ P2 10
double_arg :: Integer -> Integer -> Integer
double_arg a b = a + b
partially_applied :: Integer -> Integer
partially_applied = double_arg 7
func_arg :: (Integer -> Integer) -> Integer -> Integer
func_arg f b = f b
main :: IO () main :: IO ()
main = putStrLn "Hello world" main = putStrLn "Hello world"

@ -0,0 +1,28 @@
type Name = String
type Table = [ (Name, Name) ]
fathers :: Table
fathers = [
("a", "d"),
("b", "r")
]
head' :: [a] -> a
head' (x:xs) = x
helper :: Integer -> [a] -> Integer
helper acc (x:xs) = helper (acc + 1) xs
helper acc ([]) = acc
len' :: [a] -> Integer
len' xs = helper 0 xs
inv :: [a] -> [a]
inv _ = _
getF :: Name -> Maybe Name
getF n = lookup n fathers
Loading…
Cancel
Save