-- | Exercise 2 template. -- Instructions. -- 1. You are to write your solutions to the exercise in this file. You -- may add extra functions in this file to implement your solution. -- -- 2. You are to comment your code indicating how you arrived at a -- solution. -- -- 3. It is best to avoid Prelude and library functions not already -- imported and develop your own code for your solutions. -- -- 4. Do NOT change the type or name of any of the template functions. -- -- 5. Do NOT change the name of this file. -- -- 6. Do NOT change the module name of this file. -- -- 7. To submit this to GradeScope, submit ONLY this file. -- -- 8. Have lots of fun :). Wahoo!! module Ex2 where -- This imports the required types and support functions for the questions. import Ex2Types import Prelude (Int, Float, Integer, Eq, Ord, Bool (..), Double, String, otherwise, Num, Integral, Fractional, abs, (+), (-), (^), subtract, (*), (/), signum, (==), (/=), (<), (<=), (>), (>=), compare, (||), (&&), not, rem, mod, div, quot, max, min, fromIntegral, toInteger, undefined, error, Show, show, Bounded, minBound, maxBound, seq) import Debug.Trace -- 1 twoTautology :: ((Bool,Bool) -> Bool) -> Bool -- Provide your answer below twoTautology _ = undefined twoEquiv :: ((Bool,Bool)->Bool)->((Bool,Bool)->Bool)->Bool -- Provide your answer below twoEquiv _ _ = undefined --2 badFermat :: Integer badFermat = undefined -- 3 collatzIndex :: Int -> SF [Int] -- Provide your answer below collatzIndex _ = undefined -- 4 bisection::(Double->Double)->(Double,Double)-> SF Double -- Provide your answer below bisection _ _ = undefined -- 5 bsort:: (Ord a) => [a] -> [a] bsort _ = undefined qsort:: (Ord a) => [a] -> [a] qsort _ = undefined msort:: (Ord a) => [a] -> [a] msort _ = undefined -- 6 dimension::Matrix a -> (SF (Int,Int)) dimension _ = undefined transpose:: Matrix a -> (SF (Matrix a)) transpose _ = undefined addMat :: DoubleMatrix -> DoubleMatrix -> (SF DoubleMatrix) addMat _ _ = undefined multMat :: DoubleMatrix -> DoubleMatrix -> (SF DoubleMatrix) multMat _ _ = undefined -- 7 nreverse :: (Ord a) => [a] -> [a] nreverse _ = undefined freverse :: (Ord a) => [a] -> [a] freverse _ = undefined hreverse :: (Ord a) => [a] -> [a] hreverse _ = undefined -- 8 all_paths:: Expr f x -> [([f],x)] all_paths _ = undefined -- 9 fact :: Integer fact = undefined -- 10 widthRose :: Integral a => Rose a -> Int widthRose _ = undefined -- 11 is_ordered:: (Ord a) => STree a -> Bool is_ordered _ = undefined is_balanced:: STree a -> Bool is_balanced _ = undefined strong_balance:: STree a -> STree a strong_balance _ = undefined