# The alphabet in programming languages

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.
• 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.

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>

• Are we allowed to print junk to stderr? – Peter Taylor Apr 18 '11 at 22:02
• @Peter Taylor: Go nuts. To answer your question, yes, printing junk to stderr is fine (as long as stdout is correct). – Joey Adams Apr 18 '11 at 22:05
• Is it OK to print the alphabet IN BIG LETTERS? – user8397947 Jun 21 '16 at 18:25
• Funge is distinct from Befunge. Surely my pedanticism will be rewarded on a site dedicated to feats of it! – tngreene Mar 23 '17 at 19:53
• Is *0*5AB1E the same as *o*sabie :P? – Magic Octopus Urn Jun 6 '19 at 14:58

# K is for K, 12 characters -> Score: 13

0:_ci97+!26

• Surely you can adapt one of your solutions to A+, right? – Joey Apr 19 '11 at 6:48
• Setting up A+ is a little funky. I've done it before but I don't really feel like it. (Owl, newLISP and zshell were all turnkey.) – Jesse Millikan Apr 19 '11 at 6:53
• i assume that's k2 or k3. in k4/q, you can do it in 7 chars with 1 .Q.a;. – Aaron Davies Jan 20 '14 at 10:10
• you don't need 0: or 1@ in codegolf – ngn Jan 24 '18 at 15:34

# P is (actually) for Piet - 57 codels

Large version (codel size = 6)

Small version (codel size = 1)

Tested with Erik's piet interpreter npiet and developed with Piet Creator.

Edit: Here is a "trace" version (generated with npiet -tpf) so you can see how it works.

Execution starts in the top left and goes around the border clockwise. The top edge and right edge are setup (calculating the value of a (97) takes quite a few codels). The loop starts on the bottom edge and goes to the left edge. When the value of z is reached the program turns right into the cross section under the first P and terminates.

Click the image to enlarge and see details

• Oooh, Piet is always a nice one. And you don't happen to have a working Windows binary of Piet Creator lying around, do you? (I was too lazy to hunt all dependencies and prerequisites just to play around a bit again.) – Joey Apr 24 '11 at 21:01
• And aren't that actually 400 codels and 57 coding codels? (I don't think we had a consensus how to count Piet here, though) – Joey Apr 24 '11 at 21:04
• @Joey I'll see if I can cook up a build of Piet Creator for windows. It's been awhile since I tested it there. You're right about the codels. If I was to lay the program out in a line it would be 57 codels (give or take a few), the version above is more eye friendly (like whitespace in other langs). Perhaps Piet submissions should have both minimal and eye-catching sources. We better decide, because I'm planning many more Piet answers :) – Casey Apr 24 '11 at 21:16
• Well, you could open a question on meta to ask for clarification how Piet code should be handled :-). I would have submitted Piet solutions too, long ago. Except pietdev was quite buggy and for Piet Creator I needed Qt and a few other things just to build it ;-). And just using a bitmap editor is quite ... cumbersome ... – Joey Apr 24 '11 at 21:20
• @Joey Piet Creator still needs several important enhancements to be truly awesome, hopefully I can add those soon. I end up using mainly Piet Creator, and then use Paint or the GIMP to move blocks of color around. Pietdev was my main inspiration for PC. Getting some feedback on PC would be great, I'll get on that windows build ASAP. – Casey Apr 24 '11 at 23:55

## P is for Perl, 10 characters -> Score: 14

print a..z

• What about say a..z? – mbx Jul 5 '11 at 14:03

## Y is for Yoix, 44 characters → Score: 48

int x;for(;++x<27;)yoix.stdio.putchar(96+x);


## W is for Whitespace, 72 characters -> Score: 82

[Sp][Sp][Sp][Tab][Tab][Sp][Sp][Sp][Sp][Tab][LF][LF][Sp][Sp][Tab][Tab][LF][Sp][LF][Sp][Tab][LF][Sp][Sp][Sp][Sp][Sp][Tab][LF][Tab][Sp][Sp][Sp][Sp][LF][Sp][Sp][Sp][Sp][Tab][Tab][Tab][Tab][Sp][Tab][Tab][LF][Tab][Sp][Sp][Tab][LF][Tab][Sp][Sp][Sp][LF][LF][Sp][LF][Tab][Tab][LF][LF][Sp][Sp][Sp][Sp][LF][LF][LF][LF]


I spent ages getting this stupid thing to work last night and then found that whitespace doesn't show as code here! Then, while I was sulking, my Internet connection died. So, I'm posting it now just so I didn't waste an hour of my life last night getting it to work.

• I would have thought that it was obvious from the now-deleted comment along with my solution that I've never written any Whitespace before. Apparently not. – Gareth Apr 24 '11 at 10:04
• @Mego Any chance we can have my name taken off this since I had nothing at all to do with it? – Gareth Dec 30 '18 at 22:55

## P is for Python 2, 30 chars -> Score: 36

I did it, after 8 years I realized there is a shorter way in python 2!

print bytearray(range(97,123))


Previous code that was as big as trivial print:

print'%c'*26%tuple(range(97,123))

print'abcdefghijklmnopqrstuvwxyz'


Edit: Check out the breakthrough with Python 3 where I also found a solution smaller than trivial print: https://codegolf.stackexchange.com/a/195165/2212

• This is the same length as print'abcdefghijklmnopqrstuvwxyz'... – nneonneo Jul 14 '14 at 22:45

## A is for APL,  14  11 chars/bytes* → score 14

⎕UCS 96+⍳26


This works at least in Dyalog and Nars2000.

* APL can be written in its own (legacy) single-byte charset that maps APL symbols to the upper 128 byte values. Therefore, for the purpose of scoring, a program of N chars that only uses ASCII characters and APL symbols can be considered to be N bytes long.

• ⎕a works in APLX. – Adám May 8 '17 at 5:37
• uppercase and trailing newline optional so ⎕A works. – Adám Oct 2 '19 at 17:11

## G is for Golfscript, 8 characters -> Score: 18

123,97>+


## R is for R, 19 → Score: 20

cat(letters,sep="")

• Alternatively (20 characters): cat(letters,sep="") – Paolo Mar 7 '12 at 16:10
• Is not letters good enough? I don't see the spec specifying the output must be a contiguous string. Sure, the example given is in that form, but the 'trailing newline is optional'? – Gaffi Aug 10 '16 at 22:56
• @Gaffi: I believe I held other languages to the same standard in this thread, namely, the output must be "abc...xyz" exactly, with no intervening characters). I suppose I could change the rule and win my own contest, but that wouldn't be very fun. – Joey Adams Aug 14 '16 at 1:44

## R is for Ruby, 13 characters -> Score: 17

A Ruby 1.9 solution Matma Rex came up with:

print *?a..?z


My original Ruby 1.8 solution (15 characters -> Score: 19):

$><<[*'a'..'z']  • This one doesn't match the criteria? Output contains additional characters. Also, if it's OK, it'd be $><<[*?a..?z] for Ruby 1.9 (shaving off 2 chars). – Matma Rex Apr 19 '11 at 17:17
• Shortest correct version I can conceive is print *?a..?z. It's the same length and the one I suggested above. We can't use \$><< because << has some weird precedence rules and everything blows up. We can't use p or puts instead of print since they print every letter on separate line. – Matma Rex Apr 19 '11 at 17:26
• Sorry, should've mentioned that this is for Ruby 1.8. In Ruby 1.8, Array#to_s is the same as Array#join, so it'll just print the alphabet with no extra characters. But your 1.9 solution is indeed shorter. – Ventero Apr 19 '11 at 18:50
• Output is: codepad.org/atGFGVuQ – Nathan Osman Jul 5 '11 at 15:54
• @George: Your output is from Ruby 1.8 (which can be verified here: codepad.org/pvyqzaPP). As the post mentions, this is a solution for Ruby 1.9. – Ventero Jul 5 '11 at 18:14

## F is for Fish (><>), 19 chars -> Score: 23

Because it's a damn beautiful language!

30""1+::o&p&"y"(?;

• Isn't this answer scored 22 because <>> is only three characters long, not four. Is there a reason you used the longer name in the score. – pppery Oct 15 '15 at 18:08
• @ppperry Well the language name can't both start with an F and be <><. – flornquake Jan 5 '16 at 18:38
• The name of the language is ><>, not <>< – TuxCrafting Jun 19 '16 at 16:48
• This doesn't seem to work- it just prints a. tio.run/##S8sszvj/39hAKUHJUNvKKl@tQE2pUknD3vr/fwA – Chris Jun 6 '19 at 15:18

# O is for Owl, 11 characters -> Score: 14

a[%)1+%z>]!


## S is for Scala, 16 chars => score 21

'a'to'z'mkString


18 chars => score 23

'a'to'z'mkString""


22 chars => score 27

('a'to'z')map(print _)


# B is for Befunge → 18 characters

"a"::,1+10p"y"#@_


## P is for Python 2, 42 characters → Score: 48

import string
print string.ascii_lowercase

• print 'abcdefhijklmnopqrstuvwxyz' – Charles Beattie Jul 4 '11 at 10:15
• print'abcdefhijklmnopqrstuvwxyz' – nneonneo Jul 14 '14 at 22:45

# D is for dc, 17 characters → Score: 19

97[dP1+dBD>x]dsxx

• outputs "ab" and quits in dc version 1.06.95 – Wossname Jun 6 '17 at 13:49
• @Wossname echo '97[dP1+dBD>x]dsxx' | dc does work in dc version 1.07.1 – BlackCap Jan 27 '18 at 17:58

## C is for C, 36 35 characters → Score: 36

main(a){for(;putchar(a+++64)-90;);}

• You can drop 2 characters by assuming a (argc) equals one rather than having to initialize it. – Joey Adams Apr 18 '11 at 22:35
• But this doesn't even compile... – deceleratedcaviar Apr 24 '11 at 14:33
• Best I could get to compile was 59, or 42 without the include: #include<stdio.h> main(){for(int a=27;--a;)putchar(96+a);} – deceleratedcaviar Apr 24 '11 at 14:41
• Daniel, it works with MSVC 10 here. – Joey Apr 24 '11 at 20:51

## P is for Python 2, 41 characters → Score: 47

print''.join(chr(i+97)for i in range(26))


## P is for PowerShell, 15 characters → Score: 25

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

• Hmm, not sure whether to make this W or P. – Joey Adams Apr 18 '11 at 21:11
• Technically it's W, since the correct name of the language (and product) is Windows PowerShell. Yes, it bugs me too. – Joey Apr 18 '11 at 21:12
• The language is now just PowerShell, with the products being Windows PowerShell or PowerShell Core, so this now has a score of 32. – user8397947 Oct 31 '19 at 1:56
• @dorukayhan: When using PowerShell Core we can also shorten it to -join('a'..'z') which results in 25. – Joey Oct 31 '19 at 20:10

## B is for bc - 2 + 28 = 30

"abcdefghijklmnopqrstuvwxyz"


## L is for Logo, 26 characters → Score: 30

for[i 97 122][type char i]


## T is for Thue, 35 characters → Score: 39

0::=~abcdefghijklmnopqrstuvwxyz
::=
0


## A is for AppleScript, 41 -> Score: 52

display alert"abcdefghijklmnopqrstuvwxyz"

• I know this is a long time since posting, but you can use "abcdefghijklmnopqrstuvwxyz", since the return value is output to the results pane. – Addison Crump Feb 3 '16 at 20:45

## M for Matlab, 13 chars, Score 19

disp('a':'z')


M for Matlab, 18 chars, Score 24

disp(char(97:122))

• I don't have matlab at hand but I think you need disp(..) to prevent this outputting ans = . – Nabb Apr 24 '11 at 6:06
• Correct, changed in the answer. – jpjacobs Apr 26 '11 at 8:31

# B is for BrainF***, 38 + 9 = 47

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


Can be reduced to 31+9 = 40, if cells wrap around at 256:

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


## B is for Bash: 4 + 16 = 20

printf %s {a..z}


or 15 with just:

echo {a..z}


if output of the form a b c ... is allowed (as seen in many other answers).

• I don't think so. Linefeed is optional, output is "abcdefghijklmnopqrstuvwxyz" – user unknown Apr 19 '11 at 4:30

## I is for Inform 6, 41 + 6 = 47

[Main i;for(i=26:i--:)print(char)'z'-i;];


## U is for Unlambda - 8 + 79 = 87

.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.zr


# J is for J, 14 characters -> Score: 15

echo u:97+i.26

• Why bother with echo? u:97+i.26 is a complete J program. – Gregory Higley Apr 26 '11 at 5:34
• Because that has no output when run as a script (for me, anyway). – Jesse Millikan Apr 26 '11 at 6:06

## H is for Haskell, 21 characters → Score: 28

main=putStr['a'..'z']