68
\$\begingroup\$

Inspired by George Gibson's Print a Tabula Recta.

You are to print/output this exact text:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ

(Yes, I typed that by hand)

You are allowed to use all lowercase instead of all uppercase.

However, your choice of case must be consistent throughout the whole text.

Rules/Requirements

  • Each submission should be either a full program or function. If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. Anything else (e.g. headers in C), must be included.
  • If it is possible, provide a link to a site where your program can be tested.
  • Your program must not write anything to STDERR.
  • Standard Loopholes are forbidden.
  • Your program can output in any case, but it must be printed (not an array or similar).

Scoring

Programs are scored according to bytes, in UTF-8 by default or a different character set of your choice.

Eventually, the answer with the least bytes will win.

Submissions

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:

# [><>](http://esolangs.org/wiki/Fish), 121 bytes

Leaderboard

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

/* Configuration */

var QUESTION_ID = 87064; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 48934; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/<a/.test(lang)) lang = jQuery(lang).text();
    
    languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang > b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>
<div id="language-list">
  <h2>Winners by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>

\$\endgroup\$
8
  • 1
    \$\begingroup\$ Related. \$\endgroup\$
    – Leaky Nun
    Jul 31, 2016 at 14:03
  • 5
    \$\begingroup\$ Can the output (as the return value from a function) be an array of lines? \$\endgroup\$
    – Doorknob
    Jul 31, 2016 at 14:55
  • \$\begingroup\$ @Doorknob I would say no. \$\endgroup\$
    – Leaky Nun
    Jul 31, 2016 at 14:56
  • \$\begingroup\$ @GeorgeGibson Yes. \$\endgroup\$
    – Leaky Nun
    Jul 31, 2016 at 17:36
  • 1
    \$\begingroup\$ I'm tried of the "here's text X. Print this" kind of challenges. \$\endgroup\$ Nov 11, 2016 at 19:15

124 Answers 124

3
\$\begingroup\$

Perl, 31 bytes

-6 byte thanks to @Denis Ibaev

say$_ x$A++,$_..Z for A..Z

Needs -M5.010 to run. So run with :

perl -M5.010 -e 'say$_ x$A++,$_..Z for A..Z'  
\$\endgroup\$
4
  • \$\begingroup\$ Nice solution! You can save 1 byte though, using -65+ord instead of (ord)-65! \$\endgroup\$ Aug 1, 2016 at 15:58
  • \$\begingroup\$ Right, I was looking for a way to get rid of all those parenthesis near ord, and you found it, thanks ! \$\endgroup\$
    – Dada
    Aug 1, 2016 at 16:58
  • \$\begingroup\$ Shorter: say$_ x$A++,$_..Z for A..Z. And use -E instead of -M5.010 -e. \$\endgroup\$ Nov 3, 2016 at 7:15
  • \$\begingroup\$ @DenisIbaev Nice one, thanks! The -M5.010 doesn't count in the bytecount, so it doesn't really matter whether I use it or -E. \$\endgroup\$
    – Dada
    Nov 3, 2016 at 9:59
3
\$\begingroup\$

PHP, 75 71 bytes

for($a=join(range(A,Z));$i<26;)printf("%'$a[$i]26s
",substr($a,$i++));
\$\endgroup\$
1
  • 1
    \$\begingroup\$ "A" and "Z" need no quotes. (Notices are not output with the default config.) \$\endgroup\$
    – Titus
    Nov 11, 2016 at 11:13
3
\$\begingroup\$

Pip -n, 12 bytes

B X_.z@>_MEz

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Here's 12 bytes using map-enumerate. \$\endgroup\$
    – DLosc
    Mar 10 at 16:22
  • 1
    \$\begingroup\$ woah much gaming \$\endgroup\$
    – Razetime
    Mar 11 at 12:59
2
\$\begingroup\$

CJam, 13 bytes

'[,65>_ffe>N*

Test it here!

Explanation

'[,   e# Get character range from null-byte to 'Z'.
65>   e# Discard everything up to 'A', so we've got the upper case alphabet.
_     e# Duplicate.
ffe>  e# Nested map: for every pair of letters, computes the maximum and arranges the
      e# results in a grid.
N*    e# Join with linefeeds.
\$\endgroup\$
2
\$\begingroup\$

Python 2, 61 bytes

a=range(65,91)
for c in a:print bytearray(max(c,i)for i in a)

Inspired by (xsot’s improvement to) this answer.

\$\endgroup\$
2
\$\begingroup\$

C, 78 70 67 bytes

f(i,j){for(;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}

The code makes use of the following golfing techniques for C:

  • omit basic includes (like stdio.h)
  • omit (return) types of functions and variables, making them default to int
  • use the ternary operator instead of if-else blocks
  • use the ASCII code of a letter instead of its char representation (i.e. 65 instead of 'A')
  • use putchar to output a single character
  • abuse main's argument list
  • use puts("") to output a newline

Also, the rule If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. does not forbid the function to be called with parameters (thanks to ABcDexter!).

Try it on Ideone

An ungolfed version (without any warnings with gcc) would look like this:

#include <stdio.h>

#define MAX(x, y) (x>y ? x : y)

int main()
{
    for(int i=0; i<26; i++)
    {
        for(int j=0; j<26; j++)
            printf("%c", MAX(i, j) + 'A');
        printf("\n");
    }
    return 0;
}
\$\endgroup\$
5
  • \$\begingroup\$ Save 8 bytes: f(i,j){for(i=0;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}. You don't need a full program, just a function that has performs the same operations every time it is called (which this does). \$\endgroup\$
    – owacoder
    Aug 1, 2016 at 2:08
  • \$\begingroup\$ @owacoder Thanks, fixed it. \$\endgroup\$
    – sigalor
    Aug 1, 2016 at 7:34
  • \$\begingroup\$ Can you remove that i=0; and make the function call as f(0,0) ? \$\endgroup\$
    – ABcDexter
    Aug 2, 2016 at 7:33
  • 1
    \$\begingroup\$ @ABcDexter Yep, that should work (the rule If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. does not seem to forbid this, because it doesn't say wheather parameters to the function call are allowed). I let main call just f(0) anyway, because the initialization for the second for loop (the one with j as counter) is necessary nonetheless. \$\endgroup\$
    – sigalor
    Aug 2, 2016 at 9:01
  • \$\begingroup\$ @sigalor Yes precisely. I was trying myself in C, but saw that your code is shorter :) \$\endgroup\$
    – ABcDexter
    Aug 2, 2016 at 9:03
2
\$\begingroup\$

Bash + coreutils, 55 51 bytes

Thanks to H Walters for 4 bytes.

for i in {A..Z};{ printf %c {A..Z} '
'|tr A-$i $i;}

We output the string ABCDEFGHIJKLMNOPQRSTUVWXYZ (+newline) 26 times, and replace the first $i characters with the $ith on each iteration. We take advantage of tr repeating the last character of the replacement set to extend it as necessary.

\$\endgroup\$
1
  • \$\begingroup\$ Save 4 more bytes; replace do and done with { and } \$\endgroup\$
    – H Walters
    Aug 13, 2016 at 14:17
2
\$\begingroup\$

C, 65 63 bytes

i,k;a(j){for(;i++^702;j+=putchar(k?(j>k?j:k)+64:10)<11)k=i%27;}

Wandbox

\$\endgroup\$
1
  • \$\begingroup\$ From the challenge: "Each submission should be either a full program or function. If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. Anything else (e.g. headers in C), must be included." I don't know C: does this answer follow that rule? \$\endgroup\$
    – msh210
    Aug 1, 2016 at 19:27
2
\$\begingroup\$

PHP, 65 62 52 bytes

for($s=Z;$s++<ZZ;)echo"
"[$s[1]>A],max($s[0],$s[1]);

Why use chr when I can increment letters? Try it online.


old solution, 62 bytes:

for(;26>$b+=1/27;)echo chr(($a=++$a%27)?$a>$b?$a+64:$b+65:10);

similar approach as in my Tabula Recta answer

\$\endgroup\$
2
\$\begingroup\$

x86 assembly (32-bit), 50 bytes

fd 57 c8 00 01 00 89 ef 4f 31 c0 aa b0 5a aa 48
e0 fc b0 41 fd 31 c9 b1 1b 89 ef 4f f2 ae f3 aa
50 47 57 e8 .. .. .. .. 58 58 40 3c 5a 7e e5 c9
5f c3

Might be optimizable further, but I'm tired.

Source:

/* output the l-phabet (???) - 32 bit */
.globl main
main:
std
push %edi
enter $256, $0
/* we're actually going to have to be careful with the stack on this one, since that's where the data is going */
/* first write our initial string */
mov %ebp, %edi
dec %edi
xor %eax, %eax
stosb
mov $'Z', %al
str:
stosb
dec %eax
loopnz str

/* now start back at the end */
mov $'A', %al
replace:
std
xor %ecx, %ecx
mov $27, %cl
mov %ebp, %edi
dec %edi
repne scasb
rep stosb
/* print */
push %eax
inc %edi
push %edi
call puts
pop %eax    /* caller cleanup */
pop %eax    /* old eax */
inc %eax
cmp $'Z', %al
jle replace
leave
pop %edi
ret
\$\endgroup\$
2
\$\begingroup\$

VBA, 60 Bytes

an Anonymous VBE immediate window function that outputs the L-phabet the the VBE immediate window.

For I=65To 90:For J=65To 90:?Chr(IIf(J>I,J,I));:Next:?:Next

 

\$\endgroup\$
2
\$\begingroup\$

Pascal (FPC), 106 bytes

uses math;var c,d:word;begin for c:=65to 90do begin for d:=65to 90do write(chr(Max(c,d)));writeln;end;end.

Try it online!

\$\endgroup\$
2
\$\begingroup\$

Pepe, 88 85 bytes

REeEeeeeeErEeEeEEeEerEERREEEEEREEEereeREEEErerEEREEEEEEErereeerEEEEEeeEReeereeERrEree

Try it online!

\$\endgroup\$
2
\$\begingroup\$

MUMPS, 63 56 53 bytes

f i=65:1:90 w ! f j=65:1:90 w:j>i $c(j) w:j<=i $c(i)

Can be expanded to:

for i=65:1:90 write ! for j=65:1:90 write:j>i $char(j) write:j<=i $char(i)

! is a new line. write:<condition> only writes if the condition returns true. $char() returns the character for an ASCII value.

\$\endgroup\$
2
\$\begingroup\$

Java, 80 chars

for(int i=0,z=26;i<z*z;out.printf("%c%s",65+(i/z>i%z?i/z:i%z),++i%z>0?"":"\n"));

Try it online!

Explanation:

for(int // init
    i=0, // iterator variable
    z=26 // alphabet length constant
    ; // iterate through
    i<z*z // 26 lines of 26 characters
    ; // action after each iteration (print letters one-by-one)
    out.printf( // formatted output in one line
            "%c%s" // first argument - character, second argument - string
            , // first argument - character
            65+ // letter 'A' plus result of expression
               (i/z // line number
                   > // is greater then
                    i%z // letter position
                       ? // then
                        i/z // take line number
                           : // otherwise
                            i%z) // take letter position
            , // second argument - string
            ++ // iterator increment - go to next letter (before next iteration)
              i%z // letter position
                 >0 // is greater then 0
                   ? // then
                    "" // empty string (do nothing)
                      : // otherwise (first letter in the next line)
                       "\n" // add a line break before
    ));

Output:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
\$\endgroup\$
2
\$\begingroup\$

Deadfish~, 1293 bytes

{iiiiii}iiiiicicicicicicicicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiii}iiiiiiccicicicicicicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}dddcccicicicicicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}ddccccicicicicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}dcccccicicicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}ccccccicicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}icccccccicicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}iiccccccccicicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}iiicccccccccicicicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}iiii{c}icicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}iiiii{c}cicicicicicicicicicicicicicicic{{d}ii}c{iiiiii}iiiiii{c}ccicicicicicicicicicicicicicic{{d}ii}c{{i}ddd}ddd{c}cccicicicicicicicicicicicicic{{d}ii}c{{i}ddd}dd{c}ccccicicicicicicicicicicicic{{d}ii}c{{i}ddd}d{c}cccccicicicicicicicicicicic{{d}ii}c{{i}ddd}{c}ccccccicicicicicicicicicic{{d}ii}c{{i}ddd}i{c}cccccccicicicicicicicicic{{d}ii}c{{i}ddd}ii{c}ccccccccicicicicicicicic{{d}ii}c{{i}ddd}iii{c}cccccccccicicicicicicic{{d}ii}c{{i}ddd}iiii{cc}icicicicicic{{d}ii}c{{i}ddd}iiiii{cc}cicicicicic{{d}ii}c{{i}ddd}iiiiii{cc}ccicicicic{{d}ii}c{{i}dd}ddd{cc}cccicicic{{d}ii}c{{i}dd}dd{cc}ccccicic{{d}ii}c{{i}dd}d{cc}cccccic{{d}ii}c{{i}dd}{cc}cccccc

Try it online!

Magic.

\$\endgroup\$
2
\$\begingroup\$

Pip -l, 10 bytes

z@MX GMC26

Attempt This Online!

Explanation

z@MX GMC26
      MC    ; Map the following function over a square coordinate grid of size
        26  ; 26:
  MX        ;   Maximum of
     G      ;   The coordinate pair
 @          ;   Use that as an index into
z           ;   The lowercase alphabet
\$\endgroup\$
2
\$\begingroup\$

Excel VBA, 40 39 Bytes

Anonymous VBE immediate window function that takes no input and outputs to the ActiveSheet object

[A1:Z26]="=Char(Max(Column(),Row())+64)

Output

\$\endgroup\$
1
\$\begingroup\$

Javascript (using external library) (141 bytes)

w=>_.Range(65,26).WriteLine(x=>(_.Range(0,x-65).Write("",y=>String.fromCharCode(x))||"")+_.Range(x,91-x).Write("",z=>String.fromCharCode(z)))

Link to lib:https://github.com/mvegh1/Enumerable

Code explanation: Create char code range of integers, for each write complex predicate to new line. Predicate will create a range of (currentValue-65) values, which is the part that goes A,BB,CCC,...etc...for the case of A the Write may return null so we coerce that to an empty string. Concatenate that with the remaining sequence of the alphabet. So many bytes are coming from the String.fromCharCode lol... oh well!!!

enter image description here

\$\endgroup\$
1
\$\begingroup\$

ListSharp, 233 bytes

ROWS s=ROWSPLIT "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z" BY [","]
[FOREACH NUMB IN 1 TO 26 AS k]
{
STRG t=GETLINE s [k]
[FOREACH NUMB IN 1 TO k AS o]
STRG p=p+t
ROWS x=GETLINES s [k+1 TO 27]
STRG p=p+x+<newline>
}
SHOW=p

There are actually some tricks to get this shorter like directly accessing indexes or using c# queries since you can embed c# code in listsharp with some tricks.

But i kept it as in vanilla as possible

\$\endgroup\$
6
  • \$\begingroup\$ Can't you split by empty string? Can't you use Egyptian bracket? \$\endgroup\$
    – Leaky Nun
    Jul 31, 2016 at 18:08
  • \$\begingroup\$ for egyptian brackets i would need to write {"a","b",..."z"}, which is longer and it uses the c# method String.Split which doesnt work with an empty string, i should probably use Regex.Split for that because that does work. but too late for this challenge.. \$\endgroup\$ Jul 31, 2016 at 18:12
  • \$\begingroup\$ Eh, by "Egyptian brackets" I meant [FOREACH NUMB IN 1 TO 26 AS k]{ \$\endgroup\$
    – Leaky Nun
    Jul 31, 2016 at 18:14
  • \$\begingroup\$ ah no you cant do that ;) each line can only perform one function for readability. only few things can be embedded in listsharp but for eaxmple STRG p=p+t cannot be put in line 6 to save the temporary variable t due to the single action per line reason \$\endgroup\$ Jul 31, 2016 at 18:18
  • \$\begingroup\$ I see, thanks for teaching. \$\endgroup\$
    – Leaky Nun
    Jul 31, 2016 at 18:23
1
\$\begingroup\$

Perl 6,  67  64 bytes

my @a;@a[.[0]][.[1]]=('A'..'Z')[.max]for ^26 X ^26;.join.put for @a
my @a;@a[.[0];.[1]]=('A'..*)[.max]for ^26 X ^26;.join.put for @a

Explanation:

my @a;

# @a[ $_.[0] ][ $_.[1] ]
@a[ $_.[0] ; $_.[1] ] = (

    # infinite Range that produces:
    #   'A',  'B',  'C' ...  'Y',  'Z',
    #  'AA', 'AB', 'AC' ... 'AY', 'AZ',
    #  'BA', 'BB', 'BC' ... 'BY', 'ZZ',
    # 'AAA','AAB','AAC' ... *」
    'A' .. *

)[
    # index the Range with the max value in the "Tuple" ( 2 element List )
    $_.max
]

    for # do the above with each of the following "Tuples"

        # 「(0,0),(0,1),(0,2)...(0,25),(1,0)...(25,25)」
        ^26 X ^26;

$_.join.put for @a
  • .method where a term is expected is an implicit method call on $_ the "default" scalar.
  • ^26 is short for 0 ..^ 26 which in this case is effectively the same as 0 .. 25
  • The meta infix operator X creates the cross product of two lists
    ( accepts an optional infix operator which it applies between the elements )
\$\endgroup\$
2
  • \$\begingroup\$ Do you need my $@? \$\endgroup\$ Aug 1, 2016 at 13:52
  • \$\begingroup\$ @User112638726 Perl 6 requires you to declare your variables. \$\endgroup\$ Aug 1, 2016 at 18:10
1
\$\begingroup\$

K, 32 35 Bytes

3 more bytes to print the result without double quotes!

{-1,/[y#x@y-1;y _x]}[b]'1+!#b:.Q.A;
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ

Explanation;

.Q.A                 --> uppercase alphabet
1+!#b:.Q.A           --> Indexes from 0 til (!) count (#) .Q.A (alphabet), and add 1 to them all. Also assign .Q.A to the variable b, so we don't have to type .Q.A again!
{}[b]'1 2 3 4 5....  --> we apply the function to b (alphabet) to each (') number i.e. 1 then 2 then 3 then 4
{,/[y#x@y-1;y _x]}   --> First time, y is 1;
    y#x@y-1              --> Use y-1 (0) to index (@) into x (alphabet), then take (#) y (1) of them i.e 1#"A" returns "A", 2#"A" returns "AA" etc.
    y _x                 --> drop (_) y many elements from x
,/[y#x@y-1;y _x]     --> flatten the result
-1 res;              --> Print the result
\$\endgroup\$
1
\$\begingroup\$

Haskell, 43 41 bytes

l=['A'..'Z']
m=mapM(putStrLn.(<$>l).max)l

This defines a function that needs no imports and can just be run in a complete program by adding

main=m

Of course, we could also just name it main itself, but that is three more bytes.

Saved 2 bytes thanks to @wchargin. Depending on the interpretation of the task, we can save 2 more by deleting m= and saying that the remaining part is the function that you can put into main=...

\$\endgroup\$
2
  • \$\begingroup\$ In GHC 7.10, you can replace (`map`l) with (<$>l). \$\endgroup\$
    – wchargin
    Jul 31, 2016 at 18:44
  • \$\begingroup\$ Oh I see, thanks. \$\endgroup\$ Jul 31, 2016 at 19:52
1
\$\begingroup\$

Brainfuck, 126 bytes

++++++++++[<+++++++++<+>>-]>+++++[<+++++>-]<+[->>+++++[-<+++++<<----->>>]<+>>[-<+<<<+>>>>]<[->+<<-<<.>>>]>+<<[-<<.+>>]<<<.>->]

Still couldn't outgolf Dennis. Try it online!

Explanation

(The random plusses are to offset hyphens/minuses used in the explanation)

+++++ +++++[<+++++ ++++<+>>-]
 Set the first cell to 10 (for the newline)
 Set the seccond cell to 90 (char code of Z to match the end result of the main loop

>+++++[<+++++>-]<+
 Set the third cell to 26 (the number of lines to make)
 Tape:
  10 90 26
        ^^

[- Main loop: runs 26 times (represented by n)

  >>+++++[-<+++++<<----->>>]<+
   Bring the second cell back to 65 (char code of A)
   Set the fourth cell to 26 (the number of letters per line)
   Tape on first time through loop:
    10 65 26-n 26  0  n
+              ^^

  >>[-<+<<<+>>>>]<
   The sixth cell contains a counter n of the number of lines we've done (initially zero)
   Add n to 65 (cell 2) to skip over the letters covered by the repeated letter
   Move the counter to cell 5
    10 65+n 26-n 26  n  0
                     ^
  [->+<<-<<.>>>]>+<<
    Move the counter back to cell 6
    Output the repeated character n times
    Subtract the n from cell 4 to leave room for only the non-repeated characters
    Increment n for next time
     10 65+n 26-n 26-n  0  n
++                ^^^^

  [-<<.+>>]
   Fill the remaining spots in the line with the rest of the alphabet by outputting cell 2 and incrementing
    10 91 26-n  0  0  n
+               ^

  <<<.>-
   Put a newline (cell 1)
   Change 91 to 90 because it's easier to subtract 25 than 26 to reset it
    10 90 26-n  0  0  n
+      ^^
>]
\$\endgroup\$
1
\$\begingroup\$

VBA, 88 bytes

Function L:For i=0To 701:m=i Mod 27:d=m-i\27:L=L &IIf(26=m,vbLf,Chr(65+m+d*(d<0))):Next

An extension of my Tabula Recta answer. Again the last byte counted is the enter which generates the End Function statement. Invoke in the VBA editor Immediate window with ?L.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You don't need the space between 0 and To in For i=0 To 701 \$\endgroup\$ Jul 31, 2016 at 23:52
  • \$\begingroup\$ @JerryJeremiah - Unexpected... thanks! And I don't need the () after L either, which I usually remember... \$\endgroup\$
    – Joffan
    Aug 1, 2016 at 0:50
1
\$\begingroup\$

><>, 77 bytes

v:1->:    ?!v!
>d2*^   v&:~<&o<
v!?&-1:&<o+'@':a!
>&~&>&:1+&d2*=?^&:&'@'+o43.

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Matricks, 37 bytes

m:26:26;Fs::[m90-Q:26-Q:26-Q;];:1:26;

Simple enough. Sets it to a blank 26x26 matrix, then consecutively overwrites the top left square with the correct ascii value.

Run with python matricks.py lphabet.txt [[]] 0 --asciiprint

\$\endgroup\$
1
\$\begingroup\$

Actually, 13 bytes

5Pτú;∙♂M╪k♂Σi

Try it online!

-4 bytes from Leaky Nun, and the inspiration for 4 more, then 4 more from him, and 1 more from me

Explanation:

5Pτú;∙♂M╪k♂Σi
5Pτ            push 26
   ú;∙         Cartesian product of lowercase alphabet with itself
      ♂M       maximum of each pair
        ╪k     list of length-26 sublists
          ♂Σ   concatenate each sublist
            i  flatten and implicitly print
\$\endgroup\$
0
1
\$\begingroup\$

Pyth, 9 bytes

V._GXGNeN

Try it online: Demonstration

Explanation:

V._GXGNeN   implicit: G = "abc...xyz"
 ._G        all prefixes of G: ["a", "ab", "abc", ...]
V           for each prefix N:
    XGNeN      replace the letters of N in G by the last letter of N 

Another pretty interesting solution (12 bytes):

j.uXN.*<{N2G

First time that .* is useful!

\$\endgroup\$
1
\$\begingroup\$

Sprects, 316 bytes

:ABCDlBBCDlCCCDlDDDDlEEEElFFFFFFGcGGGGGGGcHHHHHHHcIIIIIIIIIJq00q11qttttMauuuuMavvvvNarrrrrPQknnnnQkooooQkppppRkmmmmmmSTbiiiiibjjjjjbgggggggVs
hhhhhhhWs
ffffffYZ
dddddZ
eeeeeZ:1KKKKK:0JJJJJ:dYYYYY:eZZZZZ:fXXXX:gVVV:hWWW:iTTTT:jUUUU:lEFGc:cHIJq:mSSS:nPPPP:oQQQQ:pRRRR:qKLMa:aNOPQk:kRSTb:bUVs
:rOOO:sWXYZ:tLLL:uMMM:vNNN

Basically Martin Ender's /// answer ported to Sprects and then golfed. \ns appear as spaces, this is the interpreter's error.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.