pancakes
hintbuildingAtHeight::Building -> Int -> [Char] buildingAtHeight (width, _, ch) 0 = replicate width '-' buildingAtHeight (width, height, ch) n = replicate width (if n > height then ' ' else ch)
Consider an analog for pancakes
> cakeAtHeight 0 [3,7,5,1] " * " > cakeAtHeight 1 [3,7,5,1] " ***** " > cakeAtHeight 2 [3,7,5,1] "******* " > cakeAtHeight 3 [3,7,5,1] " *** " > cakeAtHeight 500 [3,7,5,1] " "
Then consider a plural version, cakesAtHeight:
> cakesAtHeight [[3,1],[5,1,7]] 0 " * ******* \n" > cakesAtHeight [[3,1],[5,1,7]] 1 "*** * \n" > cakesAtHeight [[3,1],[5,1,7]] 2 " ***** \n"
Write cakesAtHeight in terms of a higher-order function and cakeAtHeight.