This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prnEqual :: (Eq a) => a -> a -> IO () | |
prnEqual a b = if a == b then print "True" else print "false" | |
prnGt :: (Ord a, Show a, Num a) => a -> a -> IO () | |
prnGt a b | b < 0 = error "Invalid input" | |
prnGt a b = if a > b then print a else print b | |
reverseList :: [a] -> [a] | |
reverList [] = error "List is empty" | |
reverseList l = foldl (\acc x -> x : acc) [] l -- Understand this can be done using |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Environment | |
import Data.Bool | |
import Data.List | |
checkchar :: IO Bool | |
checkchar = do c <- getChar | |
return (c == 'y') | |
addList :: Int -> [Int] -> [Int] | |
addList y (x:xs) = y:xs |