JPhrases/RotateReflect

From J Wiki
Jump to navigation Jump to search

7B. Rotations & Reflections

m0=: ] Identity
m1=: m6@m7 Three-o’clock rotation
m2=: m4@m6 Six-o’clock rotation
m3=: m4@m7 Nine-o’clock rotation
m4=: |.@] Horizontal reflection
m5=: m2@m7 Counterdiagonal reflection
m6=: |."_1@] Vertical reflection
m7=: |:@] Diagonal reflection
d8=: m0`m1`m2`m3`m4`m5`m6`m7 @. [ i d8 y gives mi y (all rotates and reflects)