The challenge here is to extend an implementation of palindrome given the following as inputs:
n > 1
and a listl
.
Your program must palindrome the list both vertically and horizontally, that is to say it must first palindrome the list itself, then each element in the list after; or the other way around. Before palindromization, all elements are ensured to be equal length. The palindrome action is then to be performed n
times in sequence until the desired output is met. The easiest way to show the expected outputs is just to run through a few examples:
One iteration performed on [123,456,789]
:
First you palindromize the list to [123,456,789,456,123]
.
- While this is not a palindrome if joined together, it is a palindrome in terms of the list.
[a,b,c]
became[a,b,c,b,a]
, so the LIST was palindromized.
Then, you palindromize each list element [12321,45654,78987,45654,12321]
.
This is how each iteration is performed, it's essentially an omnidirectional palindrome.
Given n=1 and l=[123,456,789]
:
12321
45654
78987
45654
12321
Given n=2 and l=[123,456,789]
123212321
456545654
789878987
456545654
123212321
456545654
789878987
456545654
123212321
Given n=1 and l=[3,2,1]
:
3
2
1
2
3
Given n=2 and l=["hat","mad"," a "]
:
hatahatah
madamadam
a a a a
madamadam
hatahatah
madamadam
a a a a
madamadam
hatahatah
Given n=2 and l=[" 3 ","2000"," 100"]
:
3 3 3 3
2000002000002
100 00100 001
2000002000002
3 3 3 3
2000002000002
100 00100 001
2000002000002
3 3 3 3
Given n=4 and l=["3 ","20","1 "]
:
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
Given n=3 and l=["_|__","__|_","___|"]
:
_|___|_|___|_|___|_|___|_
__|_|___|_|___|_|___|_|__
___|_____|_____|_____|___
__|_|___|_|___|_|___|_|__
_|___|_|___|_|___|_|___|_
__|_|___|_|___|_|___|_|__
___|_____|_____|_____|___
__|_|___|_|___|_|___|_|__
_|___|_|___|_|___|_|___|_
__|_|___|_|___|_|___|_|__
___|_____|_____|_____|___
__|_|___|_|___|_|___|_|__
_|___|_|___|_|___|_|___|_
__|_|___|_|___|_|___|_|__
___|_____|_____|_____|___
__|_|___|_|___|_|___|_|__
_|___|_|___|_|___|_|___|_
Given n=2 and l=["---|---","__|","___|","____|"]
:
---|-----|-----|-----|---
__| |__ __| |__
___| |___ ___| |___
____| |____ ____| |____
___| |___ ___| |___
__| |__ __| |__
---|-----|-----|-----|---
__| |__ __| |__
___| |___ ___| |___
____| |____ ____| |____
___| |___ ___| |___
__| |__ __| |__
---|-----|-----|-----|---
Rules
n
will always be greater than 1.l
will always have more than 1 element.- All elements of
l
are the same length. - This is code-golf shortest solution will be marked as winner.