74
\$\begingroup\$

Our task is to, for each letter of the (English) alphabet, write a program that prints the alphabet, in a language whose name starts with that letter.

Input: none

Output:

abcdefghijklmnopqrstuvwxyz

uppercase and trailing newline optional

Rules:

  • The scoring metric is the length of the programming language name, plus the length of the code. Hence, C will be assessed a "penalty" of 1, while GolfScript will be assessed a penalty of 10.
  • One language/implementation per answer. Multiple answers are encouraged.
  • If a programming language name's first letter is not an English letter, it should not be coerced into one. It will be treated as a separate letter (meaning less competition).
  • No answer will be accepted until every English letter has a solution.

Current rankings:

Tell me if I'm missing anybody.

Automatic leaderboard (experimental)

var QUESTION_ID=2078;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&r.indexOf('non-competing')===-1&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],lang:/<a/.test(a[1])?jQuery(a[1]).text():a[1],link:s.share_link})}),e.sort(function(e,s){var d=e.lang[0].toLowerCase(),a=s.lang[0].toLowerCase();return(d>a)-(d<a)||e.size-s.size});var s={},a=null,n="A";e.forEach(function(e){n=e.lang[0].toUpperCase(),a=e.size;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+" is for").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.lang,p=o[0].toUpperCase();s[p]=s[p]||{language:e.language,lang:e.lang,letter:p,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return(e.letter>s.letter)-(e.letter<s.letter)});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.language).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),jQuery("#languages").append(jQuery(i))}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*(?:<[^>]+>)?(?:[^]+?for )?((?:<a[^>]*?>)?(?:(?! [(=→-])[^\n,:])*[^\s,:])(?:[,:]| [(=→-]).*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px} /* font fix */ body {font-family: Arial,"Helvetica Neue",Helvetica,sans-serif;} /* #language-list x-pos fix */ #answer-list {margin-right: 200px;}
<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>Winners by Letter</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>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <h2>Everything</h2> <table class="answer-list"> <thead> <tr><td></td><td>Language</td><td>Author</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <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\$
9
  • 1
    \$\begingroup\$ Are we allowed to print junk to stderr? \$\endgroup\$ Apr 18, 2011 at 22:02
  • \$\begingroup\$ @Peter Taylor: Go nuts. To answer your question, yes, printing junk to stderr is fine (as long as stdout is correct). \$\endgroup\$
    – Joey Adams
    Apr 18, 2011 at 22:05
  • \$\begingroup\$ Is it OK to print the alphabet IN BIG LETTERS? \$\endgroup\$
    – SE is dead
    Jun 21, 2016 at 18:25
  • \$\begingroup\$ Funge is distinct from Befunge. Surely my pedanticism will be rewarded on a site dedicated to feats of it! \$\endgroup\$
    – tngreene
    Mar 23, 2017 at 19:53
  • 7
    \$\begingroup\$ Is *0*5AB1E the same as *o*sabie :P? \$\endgroup\$ Jun 6, 2019 at 14:58

164 Answers 164

1
\$\begingroup\$

N is for Nibbles, 2.5 bytes (5 nibbles) + 7 = score 9.5

|@\$l

Attempt This Online!

|           # filter
 @          # printable ASCII characters:
  \         #   is the character 
   $        #   of each of them
    l       #   a lowercase letter?
\$\endgroup\$
1
\$\begingroup\$

M is for MATL, 3 bytes, Score 7

2Y2

Try it online!

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

Q is for QuadR, 8 bytes, score: 13

819⌶⎕A⋄⍵

Try it online!

Explanation

Lowercase (819⌶ - "BIg" without a boolean is un-BIg) the uppercase alphabet (⎕A). The avoids any additional output, and the means this line should be run as code, rather than as a regex transformation.


QuadR, 4 bytes, score: 9

I didn't realise it was allowed to use uppercase alphabet, which simplifies this greatly...

⎕A⋄⍵

Try it online!

\$\endgroup\$
0
\$\begingroup\$

vimscript

What does output mean?

Assuming output to the current vim buffer is ok:

:norm aabcdefghijklmnopqrstuvwxyz

Otherwise, output to stdout:

:!echo abcdefghijklmnopqrstuvwxyz
\$\endgroup\$
0
\$\begingroup\$

AWK,33+3(Penalty)

END{for(;i<26;)printf"%c",97+i++}
\$\endgroup\$
0
\$\begingroup\$

T is for TI-BASIC, 27 + 8 = 35

"ABCDEFGHIJKLMNOPQRSTUVWXYZ

Can be run from command line, as a standalone program, or called as a function.

\$\endgroup\$
0
\$\begingroup\$

S is for Scala, Score: 40

print("abcdefghijklmnopqrstuvwxyz")
\$\endgroup\$
0
\$\begingroup\$

B is for Bash, 25 bytes

echo {a..z}|tr -d ' '

(21 bytes of code plus 4 for the language name)

\$\endgroup\$
0
\$\begingroup\$

R is for REXX, 15 characters → Score: 19

say xrange(a,z)
\$\endgroup\$
0
\$\begingroup\$

U is for uBASIC, 36 bytes → Score: 42

1 PRINT "abcdefghijklmnopqrstuvwxyz"

Try it online!

\$\endgroup\$
0
0
\$\begingroup\$

V is for VBA, 28 + 3 = 31

Anonymous VBE immediate window function that takes no input and outputs abcdefghijklmnopqrstuvwxyz to the VBE immediate window.

The two solutions below are of equal length and produce the same output

For i=97To 122:?Chr(i);:Next

Or

?"abcdefghijklmnopqrstuvwxyz
\$\endgroup\$
0
\$\begingroup\$

U is for uBASIC, 30 + 6 = 36

Anonymous function that takes no input and outputs abcdefghijklmnopqrstuvwxyz

0?"abcdefghijklmnopqrstuvwxyz"

Try it online!

\$\endgroup\$
0
0
\$\begingroup\$

S is for SmileBASIC, 27 bytes + 10 = 37

FOR I=65TO 90?CHR$(I);
NEXT

Prints the alphabet in uppercase. (I'm not sure whether this is allowed, but other people are doing it so...)

Just 1 character shorter than the (even more) boring answer:

?"abcdefghijklmnopqrstuvwxyz
\$\endgroup\$
0
\$\begingroup\$

F is for FALSE, 15 bytes +5 = 20

97[$'{-][$,1+]#

Doesn't use any letters!

Explanation:

97 {push 97 (ASCII for 'a')}
  [ {function start}
   $'{- {subtract '{' from the current letter}
       ] {function end}
        [ {function start}
         $, {print the current letter}
           1+ {add 1}
             ] {function end}
              # {while loop. Run the second function while the first doesn't return 0}
\$\endgroup\$
0
\$\begingroup\$

JavaScript, 34 + 10 = 44

alert('abcdefghijklmnopqrstuvwxyz')
\$\endgroup\$
1
  • \$\begingroup\$ alert(8337503854730415241050377135811259267835n.toString(36)) ;) \$\endgroup\$ Oct 7, 2019 at 19:21
0
\$\begingroup\$

PHP, 26 + 3 = 29

<?=implode('',range(a,z));
\$\endgroup\$
0
\$\begingroup\$

Racket, 46 bytes (score 52)

(for((i 26))(display(integer->char(+ i 97))))
\$\endgroup\$
0
\$\begingroup\$

I is for ICI, 37+3 bytes → 40

printf("abcdefghijklmnopqrstuvwxyz");
\$\endgroup\$
0
\$\begingroup\$

I is for Io, 35+2 bytes → 37

"abcdefghijklmnopqrstuvwxyz"println
\$\endgroup\$
0
0
\$\begingroup\$

C is for Common Lisp, Score 35 + 11 => 46

(princ"abcdefghijklmnopqrstuvwxyz")

Try it online!

\$\endgroup\$
0
\$\begingroup\$

H is for HTML -> 4+31

<HTML/>abcdefghijklmnopqrstuvwxyz

ps: browser will interpret the missing end tag

\$\endgroup\$
1
  • 2
    \$\begingroup\$ ABCDEFGHIJKLMNOPQRSTUVWXYZ is far better at 30. \$\endgroup\$ Aug 3, 2016 at 9:52
0
\$\begingroup\$

P is for PowerShell, 15 bytes+10 = 25

-join('a'..'z')

Try it online!

Uses the character range feature added in 6.0 to improve upon past answers.

\$\endgroup\$
0
\$\begingroup\$

Canvas, 1 byte, score: 7

Try it online!

\$\endgroup\$
0
\$\begingroup\$

CJam, 7 bytes, score: 11

Learnt this language just for solving this problem.

'{,'a,-

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Stax, 2 bytes, score: 6

Also, Stax has a built-in.

Va

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Gaia, 2 bytes, score: 6

₵a

Try it online!

\$\endgroup\$
0
\$\begingroup\$

MathGolf, 1 byte, score: 9

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Japt, 2 bytes, score: 6

;C

Try it online!

\$\endgroup\$
0
\$\begingroup\$

05AB1E, 1 byte, score: 7

A

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Jsonnet (with -S), 37 characters, score: 44

std.repeat("%c",26)%std.range(97,122)

Sample run:

bash-5.0$ jsonnet -Se 'std.repeat("%c",26)%std.range(97,122)'
abcdefghijklmnopqrstuvwxyz
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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