module Playground05 where

myList :: [Integer]
myList = 1:2:3:5:6:7:[]

myBiggerList :: [Integer]
myBiggerList = 0:myList

myString :: [Char]
myString = ['a','b']


-- Q5.1
repeat' :: a -> [a]
repeat' x = cycle [x]

-- Q5.3
inFirstHalf :: Eq a => a -> [a] -> Bool
inFirstHalf _ [] = False 
inFirstHalf element list =  
                            let listLengthNum = fromIntegral (length list)
                            in
                            let halfLengthFractional = (listLengthNum / 2 )
                            in
                            elem element (take (floor (halfLengthFractional)) list)

-- inFirstHalf' element list = 

--Listing 6.2 sayAmount v.1
sayAmount :: (Num a, Eq a) => a -> [Char]
sayAmount n = case n of
    1 -> "one"
    2 -> "two"
    _ -> "a bunch"

sayAmount' :: (Num a, Eq a) => a -> [Char]
sayAmount' 1 = "one"
sayAmount' 2 = "two"
sayAmount' _ = "a bunch"

sayAmount'' :: (Num a, Eq a) => a -> [Char]
sayAmount'' 3 = "three"
sayAmount'' n
    | n == 1 = "one"
    | n == 2 = "two"
--    | otherwise = "a bunch"
sayAmount'' n = case n of
    4 -> "four"
    _ -> "menghie"



-- 1. Identify the end goal(s).
-- 2. Determine what happens when a goal is reached.
-- 3. List all alternate possibilities.
-- 4. Determine your “rinse and repeat” process.
-- 5. Ensure that each alternative moves you toward the goal.
