Skip to content

Youngseok0001/pattern_creation_with_functional-programming.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Functional way to generate a pattern.


Tasks

  • generate the following 8 patterns


solution

  • given any pattern, create functions that can,
    • Transpose
    • Flip Horizontally
    • Flip Vertically -- f(Transpose, Flip Horizontally)
    • create Mirror Image
pattern = \
*....
.*...
..*..
...*.
....*
transpose(pattern) = \ 
*....
.*...
..*..
...*.
....*
Flip Horizontally(pattern) = \
....*
...*.
..*..
.*...
*....

Create Mirror(pattern) = \
*.......*
.*.....*.
..*...*..
...*.*...
....*....
...*.*...
..*...*..
.*.....*.
*.......*

comopse(Create Mirror,Create Mirror)(pattern) = \
*.......*.......*
.*.....*.*.....*.
..*...*...*...*..
...*.*.....*.*...
....*.......*....
...*.*.....*.*...
..*...*...*...*..
.*.....*.*.....*.
*.......*.......*
.*.....*.*.....*.
..*...*...*...*..
...*.*.....*.*...
....*.......*....
...*.*.....*.*...
..*...*...*...*..
.*.....*.*.....*.
*.......*.......*

Inspired by

  • Lecture by John Hughes link
  • Learn You a Haskell link

About

pattern_creation_with_functional programming.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published