FP Laboratory 6

From Marek Běhálek Wiki
Revision as of 14:44, 17 September 2019 by Beh01 (talk | contribs) (Created page with "== List of lists == Consider following type representing picture: <syntaxhighlight lang="Haskell">type Pic = [String]</syntaxhighlight> If you want to print this picture you...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

List of lists

Consider following type representing picture:

type Pic = [String]

If you want to print this picture you can use:

pp :: Pic -> IO ()
pp x = putStr (concat (map (++"\n") x))

Picture example:

obr :: Pic
obr = [	"....#....",
       	"...###...",
	"..#.#.#..",
	".#..#..#.",
	"....#....",
	"....#....",
	"....#####"]

Create functions that:

  • Flips picture veriticaly and horizontaly.
flipV :: Pic -> Pic
flipV :: Pic -> Pic
  • Place one picture above another.
above :: Pic -> Pic -> Pic
  • Place two pictures side by side (consider, that they have the same height).
sideBySide :: Pic -> Pic -> Pic
  • Rotate picture to the left and to the right.
rotateR :: Pic -> Pic
rotateL :: Pic -> Pic
  • Increase every point in the picture n times.
zoom :: Int -> Pic -> Pic