Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main :: IO()
- main = do
- print $ "Hello world"
- print $ "Let's do it"
- getIndices :: [Int] -> (Int -> (Int, Int))
- getIndices xs = (/x -> [(pos1, pos2) | (x1, pos1) <- zip xs [0..], (x2, pos2) <- zip xs [0..], x = x1 + x2 && pos1 /= pos2])
- removeEveryKth :: Int -> [Int] -> [Int]
- removeEveryKth n xs = helper xs 1
- where
- helper :: [Int] -> Int -> [Int]
- helper [] _ = []
- helper (x:xs) index
- | index == n = helper xs 1
- | otherwise = x : helper xs (index+1)
- factorize :: Int -> Bool
- factorize num = helper num 2
- where
- helper :: Int -> Int -> [Int]
- helper 1 _ = []
- helper leftover divs
- | mod leftover divs == 0 = divs : helper (div leftover 10) divs
- | otherwise = helepr leftover (divs+1)
- poly :: [Int] -> (Int, Int)
- poly xs = (/x -> sum [n * (x^i) | (n, i) <- zip xs [0 .. length xs]])
- listOfIndexes :: Int -> [Int] -> [Int]
- listOfIndexes n xs = (\x -> [index | (x, index) <- zip xs [0 .. length xs], x == n])
- digits :: Int -> [Int]
- digits = map digitToInt . show
- decreasing :: [Int] -> Bool
- decreasing [] = Bool
- decreasing (x:xs)
- | length xs == 1 = head xs < x
- | x > head xs = decreasing xs
- | otherwise = False
- decDigits :: Int -> Bool
- decDigits n = decreasing (digits n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement