Skip to main content
added 758 characters in body
Source Link
Zgarb
  • 42.8k
  • 4
  • 79
  • 259

Husk, 13 bytes

z+ḣ∞øzRNC1…'A

Takes a character in single quotes as command line argument, prints result to STDOUT. Try it online!

Explanation

I'm exploiting the way Husk prints lists of lists of strings: join inner lists with spaces and outer lists with newlines.

z+ḣ∞øzRNC1…'A  Implicit input, say 'C'
          …'A  Range from A: "ABC"
        C1     Cut into strings of length 1: ["A","B","C"]
     z N       Zip with positive integers
      R        using repetition: x = [["A"],["B","B"],["C","C","C"]]
   ∞ø          The empty string repeated infinitely: ["","","",...
  ḣ            Prefixes: [[],[""],["",""],["","",""],...
z+             Zip with x using concatenation: [["A"],["","B","B"],["","","C","C","C"]]
               Implicitly join each inner list with spaces, join the resulting strings with newlines and print.

Husk, 13 bytes

z+ḣ∞øzRNC1…'A

Takes a character in single quotes as command line argument, prints result to STDOUT. Try it online!

Husk, 13 bytes

z+ḣ∞øzRNC1…'A

Takes a character in single quotes as command line argument, prints result to STDOUT. Try it online!

Explanation

I'm exploiting the way Husk prints lists of lists of strings: join inner lists with spaces and outer lists with newlines.

z+ḣ∞øzRNC1…'A  Implicit input, say 'C'
          …'A  Range from A: "ABC"
        C1     Cut into strings of length 1: ["A","B","C"]
     z N       Zip with positive integers
      R        using repetition: x = [["A"],["B","B"],["C","C","C"]]
   ∞ø          The empty string repeated infinitely: ["","","",...
  ḣ            Prefixes: [[],[""],["",""],["","",""],...
z+             Zip with x using concatenation: [["A"],["","B","B"],["","","C","C","C"]]
               Implicitly join each inner list with spaces, join the resulting strings with newlines and print.
Source Link
Zgarb
  • 42.8k
  • 4
  • 79
  • 259

Husk, 13 bytes

z+ḣ∞øzRNC1…'A

Takes a character in single quotes as command line argument, prints result to STDOUT. Try it online!