Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fact x
- | (x<0) =0
- | x==0 =1
- |otherwise = x *fact (x-1)
- fact' x
- | x < 0 = 0
- fact' 0 = 1
- fact' x = x * fact (x-1)
- fact'' 0 = 1
- fact'' x = x * fact'' (x-1)
- h x
- | x < 0 = 0
- | otherwise = fact'' x
- where
- fact'' :: Integral a => a -> a
- fact'' 0 = 1
- fact'' x = x * fact'' (x-1)
- listApp :: [a -> b] -> a -> [b]
- listApp [] _ = []
- listApp (x:xs) a = x a : listApp xs a
- isPrefixOf [] _ = True
- isPrefixOf _ []= False
- isPrefixOf (x:xs) (y:ys) =x == y && isPrefixOf xs ys
- nub [] = []
- nub (x:xs) = x : nub [a | a <- xs, a /=x]
- polinom [] _ = 0
- polinom (x:xs) a = x + a * polinom xs a
- runs _ [] = []
- runs n l = take n l : runs n (drop n l)
- slice (x:xs) l = take x l : slice xs (drop x l)
- slice _ _ = []
- every _ [] = []
- every n (x:xs) = x : every n (drop (n-1) xs)
- tails [] = [[]]
- tails (x:xs) = (x:xs) : tails xs
- tails [] = [[]]
- tails list@(_:xs) = list : tails xs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement