Skip to main content
added 1014 characters in body
Source Link
Ven
  • 3.5k
  • 1
  • 19
  • 24

APL (Dyalog Unicode), 74 49 45 bytesSBCS

{⍵@(⌈x÷2)∘⍉∘(⌽⍵@(2/¨⍳x))⍣2⊢''⍴⍨2⍴x←≢⍵}(⊢,1↓⌽)

Try it online!

-11 thanks to ovs

Explanation:

{⍵@(⌈x÷2)∘⍉∘(⌽⍵@(2/¨⍳x))⍣2⊢''⍴⍨2⍴x←≢⍵}(⊢,1↓⌽)
                                      (⊢,1↓⌽) ⍝ turn "abc" into "abcba"
{                                x←≢⍵}        ⍝ x is the length of that string (passed as an argument)
                           ''⍴⍨2⍴             ⍝ Generate a blank string of x times x
                        ⍣2⊢                   ⍝ Do twice:
 ⍵@(⌈x÷2)∘⍉∘(⌽⍵@(2/¨⍳x))                      ⍝ Update our blank string with our argument (the mirrored string):
              ⍵@(2/¨⍳x)                       ⍝ Add our element horizontally, replace with our (mirrored) argument
            (⌽         )                      ⍝ Rotate vertically
          ⍉∘                                  ⍝ Transpose (double rotate, vertical and horizontal)
 ⍵@(⌈x÷2)∘                                    ⍝ Add our argument vertically to the string

Since we're doing these transposes twice, we'll have rotated our image on all four quadrants.

APL (Dyalog Unicode), 74 49 45 bytesSBCS

{⍵@(⌈x÷2)∘⍉∘(⌽⍵@(2/¨⍳x))⍣2⊢''⍴⍨2⍴x←≢⍵}(⊢,1↓⌽)

Try it online!

-11 thanks to ovs

APL (Dyalog Unicode), 74 49 45 bytesSBCS

{⍵@(⌈x÷2)∘⍉∘(⌽⍵@(2/¨⍳x))⍣2⊢''⍴⍨2⍴x←≢⍵}(⊢,1↓⌽)

Try it online!

-11 thanks to ovs

Explanation:

{⍵@(⌈x÷2)∘⍉∘(⌽⍵@(2/¨⍳x))⍣2⊢''⍴⍨2⍴x←≢⍵}(⊢,1↓⌽)
                                      (⊢,1↓⌽) ⍝ turn "abc" into "abcba"
{                                x←≢⍵}        ⍝ x is the length of that string (passed as an argument)
                           ''⍴⍨2⍴             ⍝ Generate a blank string of x times x
                        ⍣2⊢                   ⍝ Do twice:
 ⍵@(⌈x÷2)∘⍉∘(⌽⍵@(2/¨⍳x))                      ⍝ Update our blank string with our argument (the mirrored string):
              ⍵@(2/¨⍳x)                       ⍝ Add our element horizontally, replace with our (mirrored) argument
            (⌽         )                      ⍝ Rotate vertically
          ⍉∘                                  ⍝ Transpose (double rotate, vertical and horizontal)
 ⍵@(⌈x÷2)∘                                    ⍝ Add our argument vertically to the string

Since we're doing these transposes twice, we'll have rotated our image on all four quadrants.

edited body
Source Link
Ven
  • 3.5k
  • 1
  • 19
  • 24

APL (Dyalog Unicode), 74 4949 45 bytesSBCS

{⍵@(⌽∘⍉⍵@⌈x÷2)∘⍉∘(⌽⍵@(2/¨⍳x))⍣4(⍉⍣2⊢''⍴⍨2⍴x←≢⍵}(,1↓⌽⍵)@x1↓⌽)⍣2⊢''⍴⍨2⍴1-⍨2×x←≢⍵}

Try it online!Try it online!

-611 thanks to ovs

APL (Dyalog Unicode), 74 49 bytesSBCS

{(⌽∘⍉⍵@(2/¨⍳x))⍣4(⍉(,1↓⌽⍵)@x)⍣2⊢''⍴⍨2⍴1-⍨2×x←≢⍵}

Try it online!

-6 thanks to ovs

APL (Dyalog Unicode), 74 49 45 bytesSBCS

{⍵@(⌈x÷2)∘⍉∘(⌽⍵@(2/¨⍳x))⍣2⊢''⍴⍨2⍴x←≢⍵}(,1↓⌽)

Try it online!

-11 thanks to ovs

deleted 2 characters in body
Source Link
Ven
  • 3.5k
  • 1
  • 19
  • 24

APL (Dyalog Unicode), 74 74 49 bytesSBCS

{p←2/¨⍳≢⍵⋄m←⍵,1↓⌽⍵⋄m←⍵,1↓⌽⍵⋄⍵@p⌽⍵@p⊖⍵@p⌽⍵@p⊢m@(≢⍵⌽∘⍉⍵@(2/¨⍳x)⍉m@)⍣4(≢⍵⍉(⍵,1↓⌽⍵)⊢' '⍴⍨2⍴1@x)⍣2⊢''⍴⍨2⍴1-⍨2×⍨≢⍵⍨2×x←≢⍵}

Try it online!Try it online!

-6 thanks to ovs

APL (Dyalog Unicode), 74 bytesSBCS

{p←2/¨⍳≢⍵⋄m←⍵,1↓⌽⍵⋄m←⍵,1↓⌽⍵⋄⍵@p⌽⍵@p⊖⍵@p⌽⍵@p⊢m@(≢⍵)⍉m@(≢⍵)⊢' '⍴⍨2⍴1-⍨2×⍨≢⍵}

Try it online!

APL (Dyalog Unicode), 74 49 bytesSBCS

{(⌽∘⍉⍵@(2/¨⍳x))⍣4(⍉(⍵,1↓⌽⍵)@x)⍣2⊢''⍴⍨2⍴1-⍨2×x←≢⍵}

Try it online!

-6 thanks to ovs

Source Link
Ven
  • 3.5k
  • 1
  • 19
  • 24
Loading