Roll the carpetLay out the CarpetWind me a number snake!Spiral neighbourhoodsWrite the shortest code to match a tail-repeating string where one character falls off the head in each repetitionShortest code to dump a file into workable memoryFour steps to the left: vipers. Four steps to the right: a cliff. Don't die!Is it a lipogram?Turn a string into a windmillString Addition (Adding a Maximum of 9+9+9)The Three 'R's: Reverse, Reorder, RepeatVisit and exit an arrayOptimal Alphabet SteppingLay out the Carpet

meaning of に in 本当に?

Do I have a twin with permutated remainders?

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

What does the "remote control" for a QF-4 look like?

Why doesn't H₄O²⁺ exist?

Can I make popcorn with any corn?

Theorems that impeded progress

Is it unprofessional to ask if a job posting on GlassDoor is real?

NMaximize is not converging to a solution

Rock identification in KY

What does "Puller Prush Person" mean?

What is the word for reserving something for yourself before others do?

Is it possible for a square root function,f(x), to map to a finite number of integers for all x in domain of f?

infared filters v nd

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

Arrow those variables!

DC-DC converter from low voltage at high current, to high voltage at low current

How does one intimidate enemies without having the capacity for violence?

RSA: Danger of using p to create q

What does it mean to describe someone as a butt steak?

Horror movie about a virus at the prom; beginning and end are stylized as a cartoon

What would happen to a modern skyscraper if it rains micro blackholes?

Does detail obscure or enhance action?

dbcc cleantable batch size explanation



Roll the carpet


Lay out the CarpetWind me a number snake!Spiral neighbourhoodsWrite the shortest code to match a tail-repeating string where one character falls off the head in each repetitionShortest code to dump a file into workable memoryFour steps to the left: vipers. Four steps to the right: a cliff. Don't die!Is it a lipogram?Turn a string into a windmillString Addition (Adding a Maximum of 9+9+9)The Three 'R's: Reverse, Reorder, RepeatVisit and exit an arrayOptimal Alphabet SteppingLay out the Carpet













13












$begingroup$


This question is inspired by Kevin Cruijssen's question.



Now that the carpet is laid out, we want to roll it. Your task is to write a program that takes a string and returns a spiral made from this string (representing a rolled carpet viewed from the side).



The procedure for one step of rolling the carpet is the following. There is an example to illustrate what I mean. Notice that the example starts with a partially rolled carpet for better understanding:



ac
rpet


  • separate the "head" from the "tail" of the carpet: the head is what has been rolled so far, the tail is what remains to be rolled.

Head: ac Tail:
rp et


  • Rotate the head 90°, clockwise.

Rotated head: ra Tail (unchanged):
pc et


  • if the width of the new head (here 2) is less or equal than the length of the tail (here 2)

    • then, put it on top of the tail

    • else, the carpet (as it was at the begining of the step) was rolled


New carpet: ra
pc
et


Repeat the procedure as many times as needed.




Two examples showing all steps of the carpet rolling:



carpet

c
arpet

ac
rpet

ra
pc
et


0123456789

0
123456789

10
23456789

21
30
456789

432
501
6789



Some precisions:



  • You don't need to show all intermediate steps, only the rolled carpet (e.g. if you find a non-iterative way to compute the result, it's perfect). Also, you don't need to print any leading whitespace, in the examples above, I only show them to align stuff.

  • Input is a String, a list/array of char

  • Output is printed to stdout or to a file.

  • Input is nice: the length is at least 1 char, and at most a constant sufficiently small so that it doesn't cause problems, but you can't use that constant in your program; the content of the string is only nice characters ([a-zA-Z0-9]), encoding at your preference.

  • This is code-golf, so shortest answer in bytes wins. Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code.

  • Also, add an explanation for your answer if you think it is needed.









share|improve this question











$endgroup$







  • 3




    $begingroup$
    Closely related
    $endgroup$
    – Giuseppe
    12 hours ago






  • 2




    $begingroup$
    Also this one: codegolf.stackexchange.com/questions/125966/…, but none include the termination check.
    $endgroup$
    – Bromind
    12 hours ago







  • 3




    $begingroup$
    Suggested test case: ProgrammingPuzzlesAndCodeGolf - the final tail length greater than 1 tripped me up.
    $endgroup$
    – Sok
    11 hours ago











  • $begingroup$
    Where is the head on the second carpet example, where nothing is rolled up?
    $endgroup$
    – Embodiment of Ignorance
    10 hours ago






  • 1




    $begingroup$
    I think you've swapped the words "head" and "tail" here: "if the width of the new head [...] is greater or equal than the length of the tail [...]".
    $endgroup$
    – Erik the Outgolfer
    4 hours ago















13












$begingroup$


This question is inspired by Kevin Cruijssen's question.



Now that the carpet is laid out, we want to roll it. Your task is to write a program that takes a string and returns a spiral made from this string (representing a rolled carpet viewed from the side).



The procedure for one step of rolling the carpet is the following. There is an example to illustrate what I mean. Notice that the example starts with a partially rolled carpet for better understanding:



ac
rpet


  • separate the "head" from the "tail" of the carpet: the head is what has been rolled so far, the tail is what remains to be rolled.

Head: ac Tail:
rp et


  • Rotate the head 90°, clockwise.

Rotated head: ra Tail (unchanged):
pc et


  • if the width of the new head (here 2) is less or equal than the length of the tail (here 2)

    • then, put it on top of the tail

    • else, the carpet (as it was at the begining of the step) was rolled


New carpet: ra
pc
et


Repeat the procedure as many times as needed.




Two examples showing all steps of the carpet rolling:



carpet

c
arpet

ac
rpet

ra
pc
et


0123456789

0
123456789

10
23456789

21
30
456789

432
501
6789



Some precisions:



  • You don't need to show all intermediate steps, only the rolled carpet (e.g. if you find a non-iterative way to compute the result, it's perfect). Also, you don't need to print any leading whitespace, in the examples above, I only show them to align stuff.

  • Input is a String, a list/array of char

  • Output is printed to stdout or to a file.

  • Input is nice: the length is at least 1 char, and at most a constant sufficiently small so that it doesn't cause problems, but you can't use that constant in your program; the content of the string is only nice characters ([a-zA-Z0-9]), encoding at your preference.

  • This is code-golf, so shortest answer in bytes wins. Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code.

  • Also, add an explanation for your answer if you think it is needed.









share|improve this question











$endgroup$







  • 3




    $begingroup$
    Closely related
    $endgroup$
    – Giuseppe
    12 hours ago






  • 2




    $begingroup$
    Also this one: codegolf.stackexchange.com/questions/125966/…, but none include the termination check.
    $endgroup$
    – Bromind
    12 hours ago







  • 3




    $begingroup$
    Suggested test case: ProgrammingPuzzlesAndCodeGolf - the final tail length greater than 1 tripped me up.
    $endgroup$
    – Sok
    11 hours ago











  • $begingroup$
    Where is the head on the second carpet example, where nothing is rolled up?
    $endgroup$
    – Embodiment of Ignorance
    10 hours ago






  • 1




    $begingroup$
    I think you've swapped the words "head" and "tail" here: "if the width of the new head [...] is greater or equal than the length of the tail [...]".
    $endgroup$
    – Erik the Outgolfer
    4 hours ago













13












13








13


4



$begingroup$


This question is inspired by Kevin Cruijssen's question.



Now that the carpet is laid out, we want to roll it. Your task is to write a program that takes a string and returns a spiral made from this string (representing a rolled carpet viewed from the side).



The procedure for one step of rolling the carpet is the following. There is an example to illustrate what I mean. Notice that the example starts with a partially rolled carpet for better understanding:



ac
rpet


  • separate the "head" from the "tail" of the carpet: the head is what has been rolled so far, the tail is what remains to be rolled.

Head: ac Tail:
rp et


  • Rotate the head 90°, clockwise.

Rotated head: ra Tail (unchanged):
pc et


  • if the width of the new head (here 2) is less or equal than the length of the tail (here 2)

    • then, put it on top of the tail

    • else, the carpet (as it was at the begining of the step) was rolled


New carpet: ra
pc
et


Repeat the procedure as many times as needed.




Two examples showing all steps of the carpet rolling:



carpet

c
arpet

ac
rpet

ra
pc
et


0123456789

0
123456789

10
23456789

21
30
456789

432
501
6789



Some precisions:



  • You don't need to show all intermediate steps, only the rolled carpet (e.g. if you find a non-iterative way to compute the result, it's perfect). Also, you don't need to print any leading whitespace, in the examples above, I only show them to align stuff.

  • Input is a String, a list/array of char

  • Output is printed to stdout or to a file.

  • Input is nice: the length is at least 1 char, and at most a constant sufficiently small so that it doesn't cause problems, but you can't use that constant in your program; the content of the string is only nice characters ([a-zA-Z0-9]), encoding at your preference.

  • This is code-golf, so shortest answer in bytes wins. Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code.

  • Also, add an explanation for your answer if you think it is needed.









share|improve this question











$endgroup$




This question is inspired by Kevin Cruijssen's question.



Now that the carpet is laid out, we want to roll it. Your task is to write a program that takes a string and returns a spiral made from this string (representing a rolled carpet viewed from the side).



The procedure for one step of rolling the carpet is the following. There is an example to illustrate what I mean. Notice that the example starts with a partially rolled carpet for better understanding:



ac
rpet


  • separate the "head" from the "tail" of the carpet: the head is what has been rolled so far, the tail is what remains to be rolled.

Head: ac Tail:
rp et


  • Rotate the head 90°, clockwise.

Rotated head: ra Tail (unchanged):
pc et


  • if the width of the new head (here 2) is less or equal than the length of the tail (here 2)

    • then, put it on top of the tail

    • else, the carpet (as it was at the begining of the step) was rolled


New carpet: ra
pc
et


Repeat the procedure as many times as needed.




Two examples showing all steps of the carpet rolling:



carpet

c
arpet

ac
rpet

ra
pc
et


0123456789

0
123456789

10
23456789

21
30
456789

432
501
6789



Some precisions:



  • You don't need to show all intermediate steps, only the rolled carpet (e.g. if you find a non-iterative way to compute the result, it's perfect). Also, you don't need to print any leading whitespace, in the examples above, I only show them to align stuff.

  • Input is a String, a list/array of char

  • Output is printed to stdout or to a file.

  • Input is nice: the length is at least 1 char, and at most a constant sufficiently small so that it doesn't cause problems, but you can't use that constant in your program; the content of the string is only nice characters ([a-zA-Z0-9]), encoding at your preference.

  • This is code-golf, so shortest answer in bytes wins. Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code.

  • Also, add an explanation for your answer if you think it is needed.






code-golf string






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 4 hours ago







Bromind

















asked 12 hours ago









BromindBromind

1866




1866







  • 3




    $begingroup$
    Closely related
    $endgroup$
    – Giuseppe
    12 hours ago






  • 2




    $begingroup$
    Also this one: codegolf.stackexchange.com/questions/125966/…, but none include the termination check.
    $endgroup$
    – Bromind
    12 hours ago







  • 3




    $begingroup$
    Suggested test case: ProgrammingPuzzlesAndCodeGolf - the final tail length greater than 1 tripped me up.
    $endgroup$
    – Sok
    11 hours ago











  • $begingroup$
    Where is the head on the second carpet example, where nothing is rolled up?
    $endgroup$
    – Embodiment of Ignorance
    10 hours ago






  • 1




    $begingroup$
    I think you've swapped the words "head" and "tail" here: "if the width of the new head [...] is greater or equal than the length of the tail [...]".
    $endgroup$
    – Erik the Outgolfer
    4 hours ago












  • 3




    $begingroup$
    Closely related
    $endgroup$
    – Giuseppe
    12 hours ago






  • 2




    $begingroup$
    Also this one: codegolf.stackexchange.com/questions/125966/…, but none include the termination check.
    $endgroup$
    – Bromind
    12 hours ago







  • 3




    $begingroup$
    Suggested test case: ProgrammingPuzzlesAndCodeGolf - the final tail length greater than 1 tripped me up.
    $endgroup$
    – Sok
    11 hours ago











  • $begingroup$
    Where is the head on the second carpet example, where nothing is rolled up?
    $endgroup$
    – Embodiment of Ignorance
    10 hours ago






  • 1




    $begingroup$
    I think you've swapped the words "head" and "tail" here: "if the width of the new head [...] is greater or equal than the length of the tail [...]".
    $endgroup$
    – Erik the Outgolfer
    4 hours ago







3




3




$begingroup$
Closely related
$endgroup$
– Giuseppe
12 hours ago




$begingroup$
Closely related
$endgroup$
– Giuseppe
12 hours ago




2




2




$begingroup$
Also this one: codegolf.stackexchange.com/questions/125966/…, but none include the termination check.
$endgroup$
– Bromind
12 hours ago





$begingroup$
Also this one: codegolf.stackexchange.com/questions/125966/…, but none include the termination check.
$endgroup$
– Bromind
12 hours ago





3




3




$begingroup$
Suggested test case: ProgrammingPuzzlesAndCodeGolf - the final tail length greater than 1 tripped me up.
$endgroup$
– Sok
11 hours ago





$begingroup$
Suggested test case: ProgrammingPuzzlesAndCodeGolf - the final tail length greater than 1 tripped me up.
$endgroup$
– Sok
11 hours ago













$begingroup$
Where is the head on the second carpet example, where nothing is rolled up?
$endgroup$
– Embodiment of Ignorance
10 hours ago




$begingroup$
Where is the head on the second carpet example, where nothing is rolled up?
$endgroup$
– Embodiment of Ignorance
10 hours ago




1




1




$begingroup$
I think you've swapped the words "head" and "tail" here: "if the width of the new head [...] is greater or equal than the length of the tail [...]".
$endgroup$
– Erik the Outgolfer
4 hours ago




$begingroup$
I think you've swapped the words "head" and "tail" here: "if the width of the new head [...] is greater or equal than the length of the tail [...]".
$endgroup$
– Erik the Outgolfer
4 hours ago










4 Answers
4






active

oldest

votes


















2












$begingroup$

Pyth, 37 bytes



.U+j;bZ.WgleHJlhH,+_MChZ<eZJ>eZJ,]hQt


Try it online here, or verify all the test cases at once here.



.U+j;bZ.WgleHJlhH,+_MChZ<eZJ>eZJ,]hQtQ Implicit: Q=eval(input())
Trailing Q inferred
]hQ First character of Q, wrapped in an array
tQ All but the first character of Q
, 2-element array of the two previous results
This yields array with rolled carpet (as array of strings) followed by the tail
.W While condition function is truthy, execute inner function, with initial value of the above:
gleHJlhH Condition function, input H
JlhH Number of layers in the current rolled carpet, store in J
leH Lenth of the tail
g J Is the above greater than or equal to J?
,+_MChZ<eZJ>eZJ Inner function, input Z
_MChZ Rotate the current rolled carpet (transpose, then reverse each row)
+ <eZJ Append the first J characters of the tail as a new row
, Pair the above with...
>eZJ ... all but the first J characters of the tail - this is the new tail
.U+j;bZ Join the carpet roll on newlines and append the tail, implicit print





share|improve this answer











$endgroup$




















    2












    $begingroup$


    J, 73 bytes



    [:(}:@[,improve this answer











    $endgroup$











      share:@[, 









      2












      2








      2





      $begingroup$


      J, 73 bytes



      [:(:@[,improve this answer









      $endgroup$




      J, 73 bytes



      [:(:@[,{:@[,])&>/[:((|:@|.@[,#@[.]);#@[.])&>/^:(<:&#&>/)^:_,:@,:@.;.


      Try it online!



      I plan to golf this further after work tonight.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered 8 hours ago









      JonahJonah

      2,5611017




      2,5611017





















          1












          $begingroup$


          R, 146 132 bytes





          function(s)m=F[F]
          while(m=rbind(t(m)[,F:0],s[1:F])
          s=s[-1:-F]
          length(s)>sum(F<-dim(m)))0
          write(m[F:1,],1,F[1],,"")
          cat(s,sep="")


          Try it online!



          Implements the carpet-rolling procedure. Takes input as a list of characters and prints to stdout.



          Saved 14 bytes by finding a way to use a do-while loop and initializing using F.



          function(s)
          m=F[F] # logical(0); create an empty array (this gets automatically promoted to character(0) later
          while( # do-while loop
          m=rbind(t(m)[,F:0],s[1:F]) # rotate m counterclockwise and add the first F characters of s to the bottom
          s=s[-1:-F] # remove those characters
          length(s)>sum(F<-dim(m)))0 # while the number of characters remaining is greater than the sum of m's dimensions
          write(m[F:1,],1,F[1],,"") # write the rolled portion write writes down the columns, we reverse each column
          cat(s,sep="") # and write the remaining characters






          share|improve this answer











          $endgroup$

















            1












            $begingroup$


            R, 146 132 bytes





            function(s)m=F[F]
            while(m=rbind(t(m)[,F:0],s[1:F])
            s=s[-1:-F]
            length(s)>sum(F<-dim(m)))0
            write(m[F:1,],1,F[1],,"")
            cat(s,sep="")


            Try it online!



            Implements the carpet-rolling procedure. Takes input as a list of characters and prints to stdout.



            Saved 14 bytes by finding a way to use a do-while loop and initializing using F.



            function(s)
            m=F[F] # logical(0); create an empty array (this gets automatically promoted to character(0) later
            while( # do-while loop
            m=rbind(t(m)[,F:0],s[1:F]) # rotate m counterclockwise and add the first F characters of s to the bottom
            s=s[-1:-F] # remove those characters
            length(s)>sum(F<-dim(m)))0 # while the number of characters remaining is greater than the sum of m's dimensions
            write(m[F:1,],1,F[1],,"") # write the rolled portion write writes down the columns, we reverse each column
            cat(s,sep="") # and write the remaining characters






            share|improve this answer











            $endgroup$















              1












              1








              1





              $begingroup$


              R, 146 132 bytes





              function(s)m=F[F]
              while(m=rbind(t(m)[,F:0],s[1:F])
              s=s[-1:-F]
              length(s)>sum(F<-dim(m)))0
              write(m[F:1,],1,F[1],,"")
              cat(s,sep="")


              Try it online!



              Implements the carpet-rolling procedure. Takes input as a list of characters and prints to stdout.



              Saved 14 bytes by finding a way to use a do-while loop and initializing using F.



              function(s)
              m=F[F] # logical(0); create an empty array (this gets automatically promoted to character(0) later
              while( # do-while loop
              m=rbind(t(m)[,F:0],s[1:F]) # rotate m counterclockwise and add the first F characters of s to the bottom
              s=s[-1:-F] # remove those characters
              length(s)>sum(F<-dim(m)))0 # while the number of characters remaining is greater than the sum of m's dimensions
              write(m[F:1,],1,F[1],,"") # write the rolled portion write writes down the columns, we reverse each column
              cat(s,sep="") # and write the remaining characters






              share|improve this answer











              $endgroup$




              R, 146 132 bytes





              function(s)m=F[F]
              while(m=rbind(t(m)[,F:0],s[1:F])
              s=s[-1:-F]
              length(s)>sum(F<-dim(m)))0
              write(m[F:1,],1,F[1],,"")
              cat(s,sep="")


              Try it online!



              Implements the carpet-rolling procedure. Takes input as a list of characters and prints to stdout.



              Saved 14 bytes by finding a way to use a do-while loop and initializing using F.



              function(s)
              m=F[F] # logical(0); create an empty array (this gets automatically promoted to character(0) later
              while( # do-while loop
              m=rbind(t(m)[,F:0],s[1:F]) # rotate m counterclockwise and add the first F characters of s to the bottom
              s=s[-1:-F] # remove those characters
              length(s)>sum(F<-dim(m)))0 # while the number of characters remaining is greater than the sum of m's dimensions
              write(m[F:1,],1,F[1],,"") # write the rolled portion write writes down the columns, we reverse each column
              cat(s,sep="") # and write the remaining characters







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited 11 hours ago

























              answered 12 hours ago









              GiuseppeGiuseppe

              17.6k31152




              17.6k31152





















                  1












                  $begingroup$


                  Jelly, 30 bytes



                  Seems overly long...



                  ḢW,ðZU;Ls@¥©ḢWɗ,®Ẏ¤ð/ẈṢƑ$¿ḢY;Ɗ


                  Try it online!



                  How?



                  ḢW,ðZU;Ls@¥©ḢWɗ,®Ẏ¤ð/ẈṢƑ$¿ḢY;Ɗ - Main Link: list of characters
                  Ḣ - pop and yield head
                  W - wrap in a list
                  , - pair with (the remaining list after Ḣ)
                  ¿ - while...
                  $ - ...condition: last two links as a monad:
                  Ẉ - length of each
                  Ƒ - is invariant under:
                  Ṣ - sort
                  / - ...do: reduce by:
                  ð ð - the enclosed dyadic chain -- i.e. f(head, tail):
                  Z - transpose
                  U - reverse each (giving a rotated head)
                  ɗ - last three links as a dyad:
                  ¥ - last two links as a dyad:
                  L - length (i.e. number of rows in current roll)
                  @ - with swapped arguments:
                  s - split (the tail) into chunks of that length
                  © - (copy to register for later)
                  Ḣ - pop and yield head (Note register "copy" is altered too)
                  W - wrap in a list
                  ; - concatenate (the rotated head with the first chunk of the tail)
                  ¤ - nilad followed by link(s) as a nilad:
                  ® - recall from register (other chunks of tail, or an empty list)
                  Ẏ - tighten (the chunks to a flat list)
                  , - pair (the concatenate result with the tightened chunks)
                  Ɗ - last three links as a monad:
                  Ḣ - pop and yield head
                  Y - join with newline characters
                  ; - concatenate (the remaining tail)
                  - when running as a full program implicitly prints





                  share|improve this answer









                  $endgroup$

















                    1












                    $begingroup$


                    Jelly, 30 bytes



                    Seems overly long...



                    ḢW,ðZU;Ls@¥©ḢWɗ,®Ẏ¤ð/ẈṢƑ$¿ḢY;Ɗ


                    Try it online!



                    How?



                    ḢW,ðZU;Ls@¥©ḢWɗ,®Ẏ¤ð/ẈṢƑ$¿ḢY;Ɗ - Main Link: list of characters
                    Ḣ - pop and yield head
                    W - wrap in a list
                    , - pair with (the remaining list after Ḣ)
                    ¿ - while...
                    $ - ...condition: last two links as a monad:
                    Ẉ - length of each
                    Ƒ - is invariant under:
                    Ṣ - sort
                    / - ...do: reduce by:
                    ð ð - the enclosed dyadic chain -- i.e. f(head, tail):
                    Z - transpose
                    U - reverse each (giving a rotated head)
                    ɗ - last three links as a dyad:
                    ¥ - last two links as a dyad:
                    L - length (i.e. number of rows in current roll)
                    @ - with swapped arguments:
                    s - split (the tail) into chunks of that length
                    © - (copy to register for later)
                    Ḣ - pop and yield head (Note register "copy" is altered too)
                    W - wrap in a list
                    ; - concatenate (the rotated head with the first chunk of the tail)
                    ¤ - nilad followed by link(s) as a nilad:
                    ® - recall from register (other chunks of tail, or an empty list)
                    Ẏ - tighten (the chunks to a flat list)
                    , - pair (the concatenate result with the tightened chunks)
                    Ɗ - last three links as a monad:
                    Ḣ - pop and yield head
                    Y - join with newline characters
                    ; - concatenate (the remaining tail)
                    - when running as a full program implicitly prints





                    share|improve this answer









                    $endgroup$















                      1












                      1








                      1





                      $begingroup$


                      Jelly, 30 bytes



                      Seems overly long...



                      ḢW,ðZU;Ls@¥©ḢWɗ,®Ẏ¤ð/ẈṢƑ$¿ḢY;Ɗ


                      Try it online!



                      How?



                      ḢW,ðZU;Ls@¥©ḢWɗ,®Ẏ¤ð/ẈṢƑ$¿ḢY;Ɗ - Main Link: list of characters
                      Ḣ - pop and yield head
                      W - wrap in a list
                      , - pair with (the remaining list after Ḣ)
                      ¿ - while...
                      $ - ...condition: last two links as a monad:
                      Ẉ - length of each
                      Ƒ - is invariant under:
                      Ṣ - sort
                      / - ...do: reduce by:
                      ð ð - the enclosed dyadic chain -- i.e. f(head, tail):
                      Z - transpose
                      U - reverse each (giving a rotated head)
                      ɗ - last three links as a dyad:
                      ¥ - last two links as a dyad:
                      L - length (i.e. number of rows in current roll)
                      @ - with swapped arguments:
                      s - split (the tail) into chunks of that length
                      © - (copy to register for later)
                      Ḣ - pop and yield head (Note register "copy" is altered too)
                      W - wrap in a list
                      ; - concatenate (the rotated head with the first chunk of the tail)
                      ¤ - nilad followed by link(s) as a nilad:
                      ® - recall from register (other chunks of tail, or an empty list)
                      Ẏ - tighten (the chunks to a flat list)
                      , - pair (the concatenate result with the tightened chunks)
                      Ɗ - last three links as a monad:
                      Ḣ - pop and yield head
                      Y - join with newline characters
                      ; - concatenate (the remaining tail)
                      - when running as a full program implicitly prints





                      share|improve this answer









                      $endgroup$




                      Jelly, 30 bytes



                      Seems overly long...



                      ḢW,ðZU;Ls@¥©ḢWɗ,®Ẏ¤ð/ẈṢƑ$¿ḢY;Ɗ


                      Try it online!



                      How?



                      ḢW,ðZU;Ls@¥©ḢWɗ,®Ẏ¤ð/ẈṢƑ$¿ḢY;Ɗ - Main Link: list of characters
                      Ḣ - pop and yield head
                      W - wrap in a list
                      , - pair with (the remaining list after Ḣ)
                      ¿ - while...
                      $ - ...condition: last two links as a monad:
                      Ẉ - length of each
                      Ƒ - is invariant under:
                      Ṣ - sort
                      / - ...do: reduce by:
                      ð ð - the enclosed dyadic chain -- i.e. f(head, tail):
                      Z - transpose
                      U - reverse each (giving a rotated head)
                      ɗ - last three links as a dyad:
                      ¥ - last two links as a dyad:
                      L - length (i.e. number of rows in current roll)
                      @ - with swapped arguments:
                      s - split (the tail) into chunks of that length
                      © - (copy to register for later)
                      Ḣ - pop and yield head (Note register "copy" is altered too)
                      W - wrap in a list
                      ; - concatenate (the rotated head with the first chunk of the tail)
                      ¤ - nilad followed by link(s) as a nilad:
                      ® - recall from register (other chunks of tail, or an empty list)
                      Ẏ - tighten (the chunks to a flat list)
                      , - pair (the concatenate result with the tightened chunks)
                      Ɗ - last three links as a monad:
                      Ḣ - pop and yield head
                      Y - join with newline characters
                      ; - concatenate (the remaining tail)
                      - when running as a full program implicitly prints






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered 7 hours ago









                      Jonathan AllanJonathan Allan

                      53.7k535173




                      53.7k535173



























                          draft saved

                          draft discarded
















































                          If this is an answer to a challenge…



                          • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                          • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                            Explanations of your answer make it more interesting to read and are very much encouraged.


                          • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


                          More generally…



                          • …Please make sure to answer the question and provide sufficient detail.


                          • …Avoid asking for help, clarification or responding to other answers (use comments instead).




                          draft saved


                          draft discarded














                          StackExchange.ready(
                          function ()
                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f182727%2froll-the-carpet%23new-answer', 'question_page');

                          );

                          Post as a guest















                          Required, but never shown





















































                          Required, but never shown














                          Required, but never shown












                          Required, but never shown







                          Required, but never shown

































                          Required, but never shown














                          Required, but never shown












                          Required, but never shown







                          Required, but never shown







                          Popular posts from this blog

                          Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                          Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                          Tom Holland Mục lục Đầu đời và giáo dục | Sự nghiệp | Cuộc sống cá nhân | Phim tham gia | Giải thưởng và đề cử | Chú thích | Liên kết ngoài | Trình đơn chuyển hướngProfile“Person Details for Thomas Stanley Holland, "England and Wales Birth Registration Index, 1837-2008" — FamilySearch.org”"Meet Tom Holland... the 16-year-old star of The Impossible""Schoolboy actor Tom Holland finds himself in Oscar contention for role in tsunami drama"“Naomi Watts on the Prince William and Harry's reaction to her film about the late Princess Diana”lưu trữ"Holland and Pflueger Are West End's Two New 'Billy Elliots'""I'm so envious of my son, the movie star! British writer Dominic Holland's spent 20 years trying to crack Hollywood - but he's been beaten to it by a very unlikely rival"“Richard and Margaret Povey of Jersey, Channel Islands, UK: Information about Thomas Stanley Holland”"Tom Holland to play Billy Elliot""New Billy Elliot leaving the garage"Billy Elliot the Musical - Tom Holland - Billy"A Tale of four Billys: Tom Holland""The Feel Good Factor""Thames Christian College schoolboys join Myleene Klass for The Feelgood Factor""Government launches £600,000 arts bursaries pilot""BILLY's Chapman, Holland, Gardner & Jackson-Keen Visit Prime Minister""Elton John 'blown away' by Billy Elliot fifth birthday" (video with John's interview and fragments of Holland's performance)"First News interviews Arrietty's Tom Holland"“33rd Critics' Circle Film Awards winners”“National Board of Review Current Awards”Bản gốc"Ron Howard Whaling Tale 'In The Heart Of The Sea' Casts Tom Holland"“'Spider-Man' Finds Tom Holland to Star as New Web-Slinger”lưu trữ“Captain America: Civil War (2016)”“Film Review: ‘Captain America: Civil War’”lưu trữ“‘Captain America: Civil War’ review: Choose your own avenger”lưu trữ“The Lost City of Z reviews”“Sony Pictures and Marvel Studios Find Their 'Spider-Man' Star and Director”“‘Mary Magdalene’, ‘Current War’ & ‘Wind River’ Get 2017 Release Dates From Weinstein”“Lionsgate Unleashing Daisy Ridley & Tom Holland Starrer ‘Chaos Walking’ In Cannes”“PTA's 'Master' Leads Chicago Film Critics Nominations, UPDATED: Houston and Indiana Critics Nominations”“Nominaciones Goya 2013 Telecinco Cinema – ENG”“Jameson Empire Film Awards: Martin Freeman wins best actor for performance in The Hobbit”“34th Annual Young Artist Awards”Bản gốc“Teen Choice Awards 2016—Captain America: Civil War Leads Second Wave of Nominations”“BAFTA Film Award Nominations: ‘La La Land’ Leads Race”“Saturn Awards Nominations 2017: 'Rogue One,' 'Walking Dead' Lead”Tom HollandTom HollandTom HollandTom Hollandmedia.gettyimages.comWorldCat Identities300279794no20130442900000 0004 0355 42791085670554170004732cb16706349t(data)XX5557367