*UsePictures> printPicture (checker22 horse)
.......##...#######..###
.....##..#..#####..##.##
...##.....#.###..#####.#
..#.......#.##.#######.#
..#...#...#.##.###.###.#
..#...###.#.##.###...#.#
.#....#..##.#.####.##..#
..#...#.....##.###.#####
...#...#....###.###.####
....#..#....####.##.####
.....#.#....#####.#.####
......##....######..####
#######..###.......##...
#####..##.##.....##..#..
###..#####.#...##.....#.
##.#######.#..#.......#.
##.###.###.#..#...#...#.
##.###...#.#..#...###.#.
#.####.##..#.#....#..##.
##.###.#####..#...#.....
###.###.####...#...#....
####.##.####....#..#....
#####.#.####.....#.#....
######..####......##....
*UsePictures>
2つ目と3つ目:horseから目的の絵を作る関数ex242, ex243をUsePictures.hsに追記。
-- Ex2.4
ex242, ex243 :: Picture -> Picture
ex242 p = checkerH (above p ((flipV . invertColour) p))
ex243 p = checkerH (above p ((rotate . invertColour) p))
結果。
*UsePictures> printPicture (ex242 horse)
.......##...#######..###
.....##..#..#####..##.##
...##.....#.###..#####.#
..#.......#.##.#######.#
..#...#...#.##.###.###.#
..#...###.#.##.###...#.#
.#....#..##.#.####.##..#
..#...#.....##.###.#####
...#...#....###.###.####
....#..#....####.##.####
.....#.#....#####.#.####
......##....######..####
###..#######...##.......
##.##..#####..#..##.....
#.#####..###.#.....##...
#.#######.##.#.......#..
#.###.###.##.#...#...#..
#.#...###.##.#.###...#..
#..##.####.#.##..#....#.
#####.###.##.....#...#..
####.###.###....#...#...
####.##.####....#..#....
####.#.#####....#.#.....
####..######....##......
*UsePictures> printPicture (ex243 horse)
.......##...#######..###
.....##..#..#####..##.##
...##.....#.###..#####.#
..#.......#.##.#######.#
..#...#...#.##.###.###.#
..#...###.#.##.###...#.#
.#....#..##.#.####.##..#
..#...#.....##.###.#####
...#...#....###.###.####
....#..#....####.##.####
.....#.#....#####.#.####
......##....######..####
####..######....##......
####.#.#####....#.#.....
####.##.####....#..#....
####.###.###....#...#...
#####.###.##.....#...#..
#..##.####.#.##..#....#.
#.#...###.##.#.###...#..
#.###.###.##.#...#...#..
#.#######.##.#.......#..
#.#####..###.#.....##...
##.##..#####..#..##.....
###..#######...##.......
*UsePictures>
No comments:
Post a Comment