Or see the test-suite.
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack Internal:7+‘“ vibgyor”ṁµṫJZz⁶U;"⁸ŒBṚ - Link: integer :7 - integer divide by seven (number of full rainbows) ‘ - increment (the input integer) + - add (gets the number bands) “ vibgyor” - list of characters = " vibgyor" ṁ - mould like the result above (as a range) µ - start a new monadic chain J - range of length ṫ - tail (vectorises) (gets the suffixes) Z - transpose z⁶ - transpose with filler space character - (together these pad with spaces to the right) U - reverse each - (now we have the left side of the rainbow upside down) ⁸ - chain's left argument, as right argument of... " - zip with: ; - concatenation - (adds the central character) ŒB - bounce (vectorises at depth 1) - (reflects each row like [1,2,3,4] -> [1,2,3,4,3,2,1]) Ṛ - reverse (turn the rainbow up the right way) :7+‘“ vibgyor”ṁµṫJZz⁶U;"⁸ŒBṚ - Link: integer :7 - integer divide by seven (number of full rainbows) ‘ - increment (the input integer) + - add (gets the number bands) “ vibgyor” - list of characters = " vibgyor" ṁ - mould like the result above (as a range) µ - start a new monadic chain J - range of length ṫ - tail (vectorises) Z - transpose z⁶ - transpose with filler space character U - reverse each ⁸ - chain's left argument " - zip with: ; - concatenation ŒB - bounce (vectorises at depth 1) Ṛ - reverse :7+‘“ vibgyor”ṁµṫJZz⁶U;"⁸ŒBṚ - Link: integer :7 - integer divide by seven (number of full rainbows) ‘ - increment (the input integer) + - add (gets the number bands) “ vibgyor” - list of characters = " vibgyor" ṁ - mould like the result above (as a range) µ - start a new monadic chain J - range of length ṫ - tail (vectorises) (gets the suffixes) Z - transpose z⁶ - transpose with filler space character - (together these pad with spaces to the right) U - reverse each - (now we have the left side of the rainbow upside down) ⁸ - chain's left argument, as right argument of... " - zip with: ; - concatenation - (adds the central character) ŒB - bounce (vectorises at depth 1) - (reflects each row like [1,2,3,4] -> [1,2,3,4,3,2,1]) Ṛ - reverse (turn the rainbow up the right way) :7+‘“ vibgyor”ṁµṫJZz⁶U;"⁸ŒBṚ A monadic link accepting an integer which yields a list of lists of characters.
Try it online! (footer joins with newline characters)
:7+‘“ vibgyor”ṁµṫJZz⁶U;"⁸ŒBṚ - Link: integer :7 - integer divide by seven (number of full rainbows) ‘ - increment (the input integer) + - add (gets the number bands) “ vibgyor” - list of characters = " vibgyor" ṁ - mould like the result above (as a range) µ - start a new monadic chain J - range of length ṫ - tail (vectorises) Z - transpose z⁶ - transpose with filler space character U - reverse each ⁸ - chain's left argument " - zip with: ; - concatenation ŒB - bounce (vectorises at depth 1) Ṛ - reverse :7+‘“ vibgyor”ṁµṫJZz⁶U;"⁸ŒBṚ A monadic link accepting an integer which yields a list of lists of characters.
Try it online! (footer joins with newline characters)
:7+‘“ vibgyor”ṁµṫJZz⁶U;"⁸ŒBṚ A monadic link accepting an integer which yields a list of lists of characters.
Try it online! (footer joins with newline characters)
:7+‘“ vibgyor”ṁµṫJZz⁶U;"⁸ŒBṚ - Link: integer :7 - integer divide by seven (number of full rainbows) ‘ - increment (the input integer) + - add (gets the number bands) “ vibgyor” - list of characters = " vibgyor" ṁ - mould like the result above (as a range) µ - start a new monadic chain J - range of length ṫ - tail (vectorises) Z - transpose z⁶ - transpose with filler space character U - reverse each ⁸ - chain's left argument " - zip with: ; - concatenation ŒB - bounce (vectorises at depth 1) Ṛ - reverse