25 June, 2006

[Haskell] Exercise 2.5

良い絵を考えるのも面倒なので教科書の例をそのまま作ってみる。例によってUsePictures.hsに追記。

-- Ex2.5
ex25 :: Picture -> Picture
ex25 p = checkerH (above p ((flipH . invertColour) p))

*UsePictures> printPicture (ex25 horse)
.......##...#######..###
.....##..#..#####..##.##
...##.....#.###..#####.#
..#.......#.##.#######.#
..#...#...#.##.###.###.#
..#...###.#.##.###...#.#
.#....#..##.#.####.##..#
..#...#.....##.###.#####
...#...#....###.###.####
....#..#....####.##.####
.....#.#....#####.#.####
......##....######..####
######..####......##....
#####.#.####.....#.#....
####.##.####....#..#....
###.###.####...#...#....
##.###.#####..#...#.....
#.####.##..#.#....#..##.
##.###...#.#..#...###.#.
##.###.###.#..#...#...#.
##.#######.#..#.......#.
###..#####.#...##.....#.
#####..##.##.....##..#..
#######..###.......##...
*UsePictures>

No comments: