
Hello, I want to define a function blowup that takes "bang" as input and returns "baannngggg". I come up with these functions; myReverse :: [a] -> [a] myReverse [] = [] myReverse (x:xs) = myReverse xs ++ [x] buildLenList :: String -> [Int] buildLenList "" = [] buildLenList (_:xs) = [1 + length xs ] ++ buildLenList xs myRepeat :: Char -> Int -> String myRepeat x 0 = [] myRepeat x n = [x] ++ myRepeat x (n - 1) blowup :: String -> String blowup [] = [] blowup (x:xs) = myRepeat x (head ( (buildLenList (x:xs)))) ++ blowup xs With this code, blowup "bang" returns "bbbbaaanng". So I thought to insert myReverse between head and buildLenList but in that case, the result is only "bang". It seems that the evaluation of buildLenList is not working as I thought. I tried to debug that using ghci debugger but failed (still learning). Can someone explain how the evaluation is done here ? -- Fabien