# Is this skew symmetry?

In this challenge, your task is to detect (vertical) Skewer Symmetry. This means that one half of the pattern can be produced by mirroring the other half along a vertical axis, and then moving it vertically.

For example, the following pattern has skewer symmetry:

asdf
jkl;fdsa
;lkj


Because if you start from the left half...

asdf
jkl;



...then mirror it along a vertical axis...

    fdsa
;lkj



...then move it down by a character (filling the empty rows with spaces)...


fdsa
;lkj


...you get the second half.

## Rules:

• You may assume the input is rectangle and has an even number of columns.
• If the pattern itself exhibits reflection symmetry, it is considered skewer symmetry.
• This is strict character by character symmetry, so [[ is considered symmetrical, but not [].
• You should output truthy if the input has skewer symmetry, falsy otherwise.
• Default I/O rules apply, standard loopholes are banned.

## Test Cases

Truthy cases:

asdf
jkl;fdsa
;lkj

asdffdsa

[

[

  ba
abdc
cd


Falsy cases:

[
]

ab
ba

aa
a
a

a  a
b b

ab
b
a

• suggested test case: ["abfe","cdhg","efba","ghdc"]. i don't know what the result should be. – ngn Oct 4 '19 at 13:49
• Suggested test case: ["ab ", " b ", " a"] (where the columns are symmetric with the spaces stripped, but not with spaces present) – user48543 Oct 4 '19 at 15:16
• @ngn This is similar to the ["ab", "ba"] test case, result should be falsy (it’s a symmetry+rotation, while skew symmetry is only symmetry+translation). – Grimmy Oct 4 '19 at 18:12
• @Grimy Formatting ate the array. It's supposed to be four columns, with 'a' in the first and last and 'b' in the second and third. So ["ab..", "..b.", "...a"], with the dots replaced with spaces. – user48543 Oct 4 '19 at 18:19
• Suggested test case: [" ba","abdc","cd "] -> truthy (left part is moved downwards). May we assume, that the input contains only printable ASCII (' ' (space) to '~')? – nimi Oct 5 '19 at 8:29

# APL (Dyalog Unicode), 44 34 bytesSBCS

crossed out 44 is still regular 44 ;(

Hats off to @Bubbler, @ngn and @TesselatingHeckler as they managed to shave some bytes off of my solution, more or less independently but coming up with the same simplifications.

{1∊(l↓⍵)⍷⍨a/⍨∨⌿' '≠a←⊖⍵↑⍨l←2÷⍨≢⍵}⍉


Try it online!

Now I'll explain how it works:

{                                   }⍉  ⍝ We define a monadic function that we apply right after transposing (⍉) the input [this means we will be operating on columns instead of rows]
2÷⍨≢⍵    ⍝ Start by finding how many  columns the input has (≢),split that in half (2÷⍨)
l←          ⍝   and assign that to l (l←) ...
⍵↑⍨            ⍝ Using it right away to take (↑⍨) l columns from the original input ⍵
⊖               ⍝   which we then reverse (⊖) [effectively flipping the columns upside down]
a←                 ⍝   and assign to a (a←)
' '≠                   ⍝ We then compare each character in a to ' '
∨⌿                       ⍝   and we "interleave" the logical OR (∨) over the columns (⌿) [to find columns where at least one character is different from ' ']
a/⍨                          ⍝   finally selecting those columns from a (a/⍨)
⍷⍨                             ⍝ Now we superimpose that piece of the original character matrix over all possible locations
(l↓⍵)                               ⍝   of the columns of ⍵ that remain after we drop (↓) the first l columns [i.e. we take the second half of the columns]
1∊                                    ⍝   and we look for matches by checking if there is a 1 (Truthy) in any position (∊)

• Quick golf using transposed array gives 36 bytes. – Bubbler May 2 at 5:44
• @Bubbler Quick for you ⍨ ahah, thanks for the help! – RGS May 2 at 11:25
• 33: {1∊(w/⍨∨⌿' '≠w←⊖l↓⍵)⍷⍵↓⍨l←2÷⍨≢⍵}⍉ – Adám May 6 at 13:34

# J, 3423 38 bytes

1 e.[:(e.&:((-:@#{.])"1)|."1\.)"2],:|.


Try it online!

thanks to nimi for catching a bug

Will attempt to regolf the fixed version later.

f s=uncurry(#)$unzip$splitAt(div(length$s!!0)2)<$>s
a#b@(x:y)|e$last a++x=init a#y|e$last b++a!!0=b#a|r<-reverse<\$>b=a==r