# 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.
• The programming language should have existed prior to the writing of this post, on this eighteenth of April 2011.
• 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? – dorukayhan 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 anyone going to update the rankings? – 12Me21 Feb 1 '18 at 15:17

## S is for Scheme, 37 -> Score: 43

(display"abcdefghijklmnopqrstuvwxyz")


L is for LUA: 3 + 40 = 43

repeat n=1+(n or 96)print(("%c"):format(n))until(n>122)


-> 55

repeat n=1+(n or 96)print(string.char(n))until(n>122)


-> 53

for i=97,122 do print(string.char(i))end


-> 40

• Please keep the code blocks clean, so user scripts like Code Golf UserScript Enhancement Pack which insert code block sizes in the document can show correct values. I mean, please post separate solutions in separate code blocks and specify the code length outside the code block. – manatwork Oct 20 '14 at 10:17
• Thanks. This way is much easier to spot out count mistakes: i.stack.imgur.com/qezQZ.png Seems you included in both cases the final newline character in the count. That is unnecessary. – manatwork Oct 20 '14 at 10:29
• @manatwork do you happen to have that userscript lying around anywhere...? the dl link is borked :/ – cat Dec 23 '15 at 19:20
• Sorry @cat, I used to mention that one in the comments, as I consider it the official one, but I use a simple one written for my own need. – manatwork Dec 23 '15 at 19:34
• You can remove 2 bytes (and obfuscate) by using ("").char in place of string.char. – cyclaminist Dec 23 '18 at 12:52

## P is for PostScript, 29 chars → Score: 39

(abcdefghijklmnopqrstuvwxyz)=


## B, 45 -> Score: 46

main(){auto i;i=95;while(i++<122)putchar(i);}


## E, 28 characters → Score: 29

for x in 0..25{print('a'+x)}


## Q is for QBasic, 29 characters → Score: 35

?"abcdefghijklmnopqrstuvwxyz"


Untested, but programming is like riding a bike, right?

• You can get injured while riding a bike. I dare you to drop that space before the quotation mark. – Joey Adams Apr 18 '11 at 22:38
• Nah, that would look too much like "optimized" BASIC programs... – ninjalj Apr 18 '11 at 22:43
• You can use ? instead of print ... – Joey Apr 18 '11 at 23:06
• Feel free to edit, I haven't programmed in BASIC for more than a decade. – ninjalj Apr 18 '11 at 23:11
• You can drop the last quotation mark - QBasic will fix that for you! – steenbergh Dec 23 '18 at 9:07

# N is for newLISP, 35 characters -> Score: 42

(print"abcdefghijklmnopqrstuvwxyz")


## L#, 28 characters → Score: 30

"abcdefghijklmnopqrstuvwxyz"


# Z is for zsh, 31 characters -> Score: 38

echo abcdefghijklmnopqrstuvwxyz


# F is for False, 17 characters -> Score: 22

97[$123\>][$,1+]#


## U is for Unicon, 50 + 6 = 56

procedure main();every writes(char(97 to 122));end


## c,34 characaters -> score : 35

main(a){for(;a++<27;putch(95+a));}

• putch isn't in standard C, and isn't present on my system. Thus, I'm not going to add this to the rankings, at least not under C. Arguably, you could change the language name to "VC" (for (Microsoft) Visual C) and put it under V ;-) – Joey Adams Apr 20 '11 at 16:35
• @Joey: Shouldn't any C example be classified under the compiler name, then? – Joey Apr 24 '11 at 21:11
• @Joey, @avinashse: I went ahead and reluctantly added this to the scoreboard. – Joey Adams Apr 25 '11 at 18:10
• talking about vc++... if you set the entry point to f and the subsystem to console, you get a breathtaking 1 + 30 = 31 f(a){26-a&&f(putch(a+97)-96);} :) – bebe Jul 14 '14 at 20:13

## Q is for Q (4 characters) -> Score 5

.Q.a


Output:

"abcdefghijklmnopqrstuvwxyz"


If this isn't valid base don the rules I'm afraid Q doesn't actually permit strings to be outputted. The closest it can get is to cast as a symbol:

$.Q.a  Output: abcdefghijklmnopqrstuvwxyz  • What is the Q programming language? Could you provide a link? – Joey Adams Mar 7 '12 at 16:58 • Yeah sure here is a link to the wikipedia page for the language, and the trial version can be downloaded here for personal/non-commercial use. – sinedcm Mar 8 '12 at 12:29 • Nice find! I really want to put this on the scoreboard and accept it, but it doesn't match the required output format. Is there a way to get rid of the quote characters? The current winner has a score of 13, so you have 7 characters of breathing room. – Joey Adams Mar 8 '12 at 14:28 • Unfortunately it isn't possible in Q, How about a 2 point penalty for the extra characters in the output? :) – sinedcm Mar 8 '12 at 16:43 • For 8 characters, -1@.Q.a; – skeevey May 30 '12 at 14:25 # V is for VBA - 43 (40+3) or 32 (29+3) (formatted to run in the immediate window) 40 chars For b=65 To 90:c=c & Chr(b):Next:Print c  And shorter, but no thinking involved: 29 chars ?"abcdefghijklmnopqrstuvwxyz"  • You can crunch the loop method to 27+3 by using ? for print and ; to make it not insert a newline. for i=65to 90:?chr(i);:next – JesterBLUE Jul 15 '14 at 12:57 ## A is for awk: 37 characters -> score 40 BEGIN{for(i=96;i++<122;)printf"%c",i}  Forth, 29 + 5 Score: 34 : a 123 97 do i emit loop ; a  Previous (Forth, 48 + 5 Score: 53 (unclean score = 48)) : a 97 begin dup emit 1 + dup 123 = until drop ;  This is the clean version. : a 97 begin dup emit 1 + dup 123 = until ;  The second one leaves stuff on the stack. a abcdefghijklmnopqrstuvwxyz ok  • Or even : b ." abcdefghijklmnopqrstuvwxyz" ; at 36 characters – leancz Dec 16 '13 at 12:17 • If uppercase output were permitted then you could drop a character with 91 65 do ... I have to say you should probably include the word a (+2 chars) at the end of your line for these to be "programs", otherwise nothing is actually executed or printed. :( I do like golfing in Forth but it often carries that penalty! – Darren Stone Dec 17 '13 at 9:46 • @DarrenStone OK, I've changed it - I do wonder about that though as I see, for example C source code in code golf that would also not print anything without being compiled and executed at a command line. I'm just starting out at code golf and trying to remember Forth from my youth. It is fun. – leancz Dec 17 '13 at 10:12 • Yeah, it sucks that control structures (IF, LOOP, etc.) can't be used in interpreted mode, only in a word definition. Shaving down your string constant idea, the following would be a program and requires no word definition/execution penalty. ." abcdefghijklmnopqrstuvwxyz" Unfortunately, it's 30 chars! Happy Forthing! – Darren Stone Dec 17 '13 at 10:21 # A is for APL, 9 characters → Score: 12 17↓43↑⎕av  Take the first 43 characters from ⎕av, then drop the first 17 of those. (Tested in Dyalog APL) • Are you sure this works in a version of Dyalog that predates the question? – lirtosiast Feb 3 '16 at 20:53 • I checked via archive.org what the current version was in February, 2011, which was 12.1. Checking the manual for that shows that ⎕av was a feature, so it should work. – Koneke Feb 3 '16 at 21:30 • Sounds good; I'd appreciate if you test it though. – lirtosiast Feb 3 '16 at 21:38 • Couldn't get hold of a 12.1 myself, but I asked the developers of Dyalog, and they tried it and confirmed that it worked the same all the way back to 10.0, which should be well before the question was posted :) twitter.com/dyalogapl/status/695184773266960384 – Koneke Feb 4 '16 at 12:20 # G is for GP, 30 characters -> score 32 Strchr(vectorsmall(26,i,96+i))  If I stole the 36-character C code I could submit it as a score-40 submission for PARI -- though maybe at that point I'd be required to #include <pari/pari.h> at the painful cost of an additional 23 characters. I'm too embarrassed to submit "abcdefghijklmnopqrstuvwxyz"  which would be printed in gp. # A is for APL, 2 → 5 ⎕a  Works on MicroAPL's APLX. ## m4, 26 characters -> Score: 28 abcdefghijklmnopqrstuvwxyz  (Hey, shinh lists it as a supported language) # Xtal, 31 characters -> Score: 35 "abcdefghijklmnopqrstuvwxyz".p;  • Awesome, thanks for filling in X with something interesting! I guess you mean Gnu Xtal System (found with a Google search), but I'm not sure. Could you add a link? – Joey Adams Apr 18 '11 at 23:37 • It's actually Xtal as used in golf.shinh.org: code.google.com/p/xtal-language , you can see some post-mortems at golf.shinh.org/l.rb?xtal – ninjalj Apr 18 '11 at 23:48 ## V is for Vim, 9+3 → Score: 12 :h<_<CR>LY<C-^>P  The screen must be exactly 66 characters wide, and 8 lines high. You can check this with tput cols and tput lines. The program should be executed with: echo>file.txt && /bin/vim -u NONE$'+normal :h<_\xALYZQP' '+wq' file.txt && cat file.txt


As discussed in this vim scoring meta post

• Since a trailing newline is optional, you might as well drop the V to save a byte, and replace the p by P – oktupol Jan 25 '18 at 9:48

## G is for Groovy, 25 -> Score: 31

('a'..'z').each{print it}


# P is for Pyth, 1 -> Score: 5 (non-competing)

G


My language is too new to count, by the way.

# C is (actually) for Cornflakes - Score: 11 (non-competing)

a

In Cornflakes, a adds the lowercase English alphabet to the stack & then implicitly outputs it.

• I am marking this as non-compeating because cornflakes was made in 2016, and the question explicitly says that it has to be older than April 2011 – BlackCap Jan 27 '18 at 16:15

# B is for Brainfuck, 42 Bytes + 9 = Score 51

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


## Ungolfed and commented

+++++++++[>+++++++++++>+++<<-]  Leaves the tape with the values 99 and 27.
>--                             Subtracts 2 from 99 to make 97, the ASCII Code for an "a".
>-                              Subtracts 1 from 27 to make 26, the number of letters in the alphabet.
[-<.+>]                         Outputs the letter, adds 1 and decrements from the number of letters remaining.
When no letters are remaining, the loop Exits.


# brainfuck, 60 -> 69

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


Try it online!

-2 bytes thanks to Dust

• Consider doing the addition at the beginning (the first 3 chars) later in the code. You could golf 2 bytes with +++++[>+++++<-]>+>++++++++[>+++[>++++<-]<-]>>+<<<[>>>.+<<<-]. – Dust Jan 28 '18 at 9:09

# B is for brainfuck, 32 31 + 9 = 40

-1 byte thanks to Jo King

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


Try it online!

-[>++>+<<-----]> is derived from the initialization part for 51 and generates the following layout: 102|51. The next part >----->+ changes this to 97|52 where 52 is double the amount of letters in the alphabet and 97 is the charcode of a. The final loop [<.+>--] prints a letter and increments the charcode and decrements the counter twice.

## K is for Keg, 9 bytes -> Score: 12

a(|:,1+)


The control character 0x0C should be added between ( and |.

• Is there supposed to be a trailing newline? I only count 8 bytes. – mbomb007 Jun 6 at 19:19
• There should not be a trailing newline. – A _ Jun 7 at 2:03
• By the way, the control character is the number of times the loop should be run. The control character 0x0C should be added between ( and |. The control characters cannot be put into this website, due to technical limitations. – A _ Jun 7 at 2:04
• That should be explained in the answer itself. Please update it. – tripleee Jun 7 at 4:53

## B is for Batch File, 31 characters → Score: 41

echo abcdefghijklmnopqrstuvwxyz