The alphabet in programming languages

71

11

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>

Joey Adams

Posted 2011-04-18T20:41:31.673

Reputation: 9 929

Is it OK to print the alphabet IN BIG LETTERS? – user8397947 – 2016-06-21T18:25:10.637

Funge is distinct from Befunge. Surely my pedanticism will be rewarded on a site dedicated to feats of it! – tngreene – 2017-03-23T19:53:32.703

Is anyone going to update the rankings? – 12Me21 – 2018-02-01T15:17:07.033

1Are we allowed to print junk to stderr? – Peter Taylor – 2011-04-18T22:02:21.333

@Peter Taylor: Go nuts. To answer your question, yes, printing junk to stderr is fine (as long as stdout is correct). – Joey Adams – 2011-04-18T22:05:46.530

4Is *0*5AB1E the same as *o*sabie :P? – Magic Octopus Urn – 2019-06-06T14:58:44.057

Does "x86" work as the name for x86 machine code? Out of all ISAs, x86 is clearly recognizable as the name of this one. It's not a language that people regularly program in directly; usually we generate it from assembly language (or higher level languages) so "x86 machine code" is as much a description as a name. A 9-byte x86 function was straightforward, so that would give a score of 12. Or 11 if we use "IA" (Intel Architecture) as the name of the language, but xtal 35 has much more room for improvement so that's a more useful answer to reducing the total sum length across all letters. – Peter Cordes – 2019-10-06T15:37:37.950

Is ,,, the same as (*C*ommata) :P? – None – 2019-12-04T13:14:50.537

Answers

13

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

`0:_ci97+!26

Jesse Millikan

Posted 2011-04-18T20:41:31.673

Reputation: 1 438

3i assume that's k2 or k3. in k4/q, you can do it in 7 chars with 1 .Q.a;. – Aaron Davies – 2014-01-20T10:10:18.620

you don't need \0:or1@` in codegolf – ngn – 2018-01-24T15:34:50.047

Surely you can adapt one of your solutions to A+, right? – Joey – 2011-04-19T06:48:27.690

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 – 2011-04-19T06:53:38.347

26

P is (actually) for Piet - 57 codels

Large version (codel size = 6)

p is for piet - big

Small version (codel size = 1)

p is for piet - small

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

Casey

Posted 2011-04-18T20:41:31.673

Reputation: 3 129

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 – 2011-04-24T21:01:51.600

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 – 2011-04-24T21:04:14.903

1@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 – 2011-04-24T21:16:39.263

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 – 2011-04-24T21:20:53.527

@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 – 2011-04-24T23:55:48.440

@Joey The github site now has a windows build from today. Let me know if you find any bugs (I'm sure you will). My email is in the README. https://github.com/Ramblurr/PietCreator/downloads

– Casey – 2011-04-25T02:50:24.810

17

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

print a..z

Ventero

Posted 2011-04-18T20:41:31.673

Reputation: 9 842

30What about say a..z? – mbx – 2011-07-05T14:03:11.927

14

Y is for Yoix, 44 characters → Score: 48

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

Joey

Posted 2011-04-18T20:41:31.673

Reputation: 12 260

13

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

enter image description here

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

Gareth

Posted 2011-04-18T20:41:31.673

Reputation: 11 678

6I 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 – 2011-04-24T10:04:30.403

@Mego Any chance we can have my name taken off this since I had nothing at all to do with it? – Gareth – 2018-12-30T22:55:10.803

13

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

JBernardo

Posted 2011-04-18T20:41:31.673

Reputation: 1 659

2This is the same length as print'abcdefghijklmnopqrstuvwxyz'... – nneonneo – 2014-07-14T22:45:15.217

11

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.

jpjacobs

Posted 2011-04-18T20:41:31.673

Reputation: 3 440

1⎕a works in APLX. – Adám – 2017-05-08T05:37:04.317

uppercase and trailing newline optional so ⎕A works. – Adám – 2019-10-02T17:11:49.747

10

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

123,97>+

Ventero

Posted 2011-04-18T20:41:31.673

Reputation: 9 842

9

R is for R, 19 → Score: 20

cat(letters,sep="")

Joey Adams

Posted 2011-04-18T20:41:31.673

Reputation: 9 929

Alternatively (20 characters): cat(letters,sep="") – Paolo – 2012-03-07T16:10:38.610

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 – 2016-08-10T22:56:25.843

@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 – 2016-08-14T01:44:47.040

7

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']

Ventero

Posted 2011-04-18T20:41:31.673

Reputation: 9 842

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 – 2011-04-19T17:17:59.957

1Shortest 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 – 2011-04-19T17:26:47.637

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 – 2011-04-19T18:50:09.903

Output is: http://codepad.org/atGFGVuQ

– Nathan Osman – 2011-07-05T15:54:42.023

@George: Your output is from Ruby 1.8 (which can be verified here: http://codepad.org/pvyqzaPP). As the post mentions, this is a solution for Ruby 1.9.

– Ventero – 2011-07-05T18:14:01.387

@Vent: Sorry... I really know nothing about Ruby, so please forgive me :) – Nathan Osman – 2011-07-05T20:14:12.370

7

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

Because it's a damn beautiful language!

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

jpjacobs

Posted 2011-04-18T20:41:31.673

Reputation: 3 440

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 – 2015-10-15T18:08:30.367

@ppperry Well the language name can't both start with an F and be <><. – flornquake – 2016-01-05T18:38:16.433

1The name of the language is ><>, not <>< – TuxCrafting – 2016-06-19T16:48:50.097

This doesn't seem to work- it just prints a. https://tio.run/##S8sszvj/39hAKUHJUNvKKl@tQE2pUknD3vr/fwA

– Chris – 2019-06-06T15:18:43.953

6

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 _)

Gareth

Posted 2011-04-18T20:41:31.673

Reputation: 11 678

6

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

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

Joey

Posted 2011-04-18T20:41:31.673

Reputation: 12 260

You can drop 2 characters by assuming a (argc) equals one rather than having to initialize it. – Joey Adams – 2011-04-18T22:35:11.293

But this doesn't even compile... – deceleratedcaviar – 2011-04-24T14:33:41.320

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 – 2011-04-24T14:41:09.723

Daniel, it works with MSVC 10 here. – Joey – 2011-04-24T20:51:48.663

6

D is for dc, 17 characters → Score: 19

97[dP1+dBD>x]dsxx

ninjalj

Posted 2011-04-18T20:41:31.673

Reputation: 3 018

outputs "ab" and quits in dc version 1.06.95 – Wossname – 2017-06-06T13:49:27.287

@Wossname echo '97[dP1+dBD>x]dsxx' | dc does work in dc version 1.07.1 – BlackCap – 2018-01-27T17:58:07.523

6

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

a[%)1+%z>]!

Jesse Millikan

Posted 2011-04-18T20:41:31.673

Reputation: 1 438

6

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

import string
print string.ascii_lowercase

Helper Method

Posted 2011-04-18T20:41:31.673

Reputation: 141

6print 'abcdefhijklmnopqrstuvwxyz' – Charles Beattie – 2011-07-04T10:15:45.863

7print'abcdefhijklmnopqrstuvwxyz' – nneonneo – 2014-07-14T22:45:47.177

6

B is for Befunge → 18 characters

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

ninjalj

Posted 2011-04-18T20:41:31.673

Reputation: 3 018

Can be done in 16 characters, for a score of 23.

– James Holderness – 2018-01-27T18:36:50.360

5

P is for PowerShell, 15 characters → Score: 25

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

Joey

Posted 2011-04-18T20:41:31.673

Reputation: 12 260

1Hmm, not sure whether to make this W or P. – Joey Adams – 2011-04-18T21:11:05.907

1Technically it's W, since the correct name of the language (and product) is Windows PowerShell. Yes, it bugs me too. – Joey – 2011-04-18T21:12:05.813

The language is now just PowerShell, with the products being Windows PowerShell or PowerShell Core, so this now has a score of 32. – user8397947 – 2019-10-31T01:56:20.427

@dorukayhan: When using PowerShell Core we can also shorten it to -join('a'..'z') which results in 25. – Joey – 2019-10-31T20:10:02.307

5

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

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

Oleh Prypin

Posted 2011-04-18T20:41:31.673

Reputation: 706

4

B is for bc - 2 + 28 = 30

"abcdefghijklmnopqrstuvwxyz"

Joey Adams

Posted 2011-04-18T20:41:31.673

Reputation: 9 929

4

L is for Logo, 26 characters → Score: 30

for[i 97 122][type char i]

PleaseStand

Posted 2011-04-18T20:41:31.673

Reputation: 5 369

4

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

Eelvex

Posted 2011-04-18T20:41:31.673

Reputation: 5 204

I don't think so. Linefeed is optional, output is "abcdefghijklmnopqrstuvwxyz" – user unknown – 2011-04-19T04:30:05.017

4

T is for Thue, 35 characters → Score: 39

0::=~abcdefghijklmnopqrstuvwxyz
::=
0

Joey

Posted 2011-04-18T20:41:31.673

Reputation: 12 260

4

M for Matlab, 13 chars, Score 19

disp('a':'z')

M for Matlab, 18 chars, Score 24

disp(char(97:122))

jpjacobs

Posted 2011-04-18T20:41:31.673

Reputation: 3 440

1I don't have matlab at hand but I think you need disp(..) to prevent this outputting ans =. – Nabb – 2011-04-24T06:06:38.930

Correct, changed in the answer. – jpjacobs – 2011-04-26T08:31:39.493

4

A is for AppleScript, 41 -> Score: 52

display alert"abcdefghijklmnopqrstuvwxyz"

Lowjacker

Posted 2011-04-18T20:41:31.673

Reputation: 4 466

1I 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 – 2016-02-03T20:45:17.033

4

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

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

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

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

Ry-

Posted 2011-04-18T20:41:31.673

Reputation: 5 283

3

I is for Inform 6, 41 + 6 = 47

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

Joey Adams

Posted 2011-04-18T20:41:31.673

Reputation: 9 929

3

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

Joey Adams

Posted 2011-04-18T20:41:31.673

Reputation: 9 929

3

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

echo u:97+i.26

Jesse Millikan

Posted 2011-04-18T20:41:31.673

Reputation: 1 438

Why bother with echo? u:97+i.26 is a complete J program. – Gregory Higley – 2011-04-26T05:34:27.093

5Because that has no output when run as a script (for me, anyway). – Jesse Millikan – 2011-04-26T06:06:50.090

3

Q is for QBasic, 29 characters → Score: 35

?"abcdefghijklmnopqrstuvwxyz"

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

ninjalj

Posted 2011-04-18T20:41:31.673

Reputation: 3 018

You can get injured while riding a bike. I dare you to drop that space before the quotation mark. – Joey Adams – 2011-04-18T22:38:33.413

Nah, that would look too much like "optimized" BASIC programs... – ninjalj – 2011-04-18T22:43:01.940

2You can use ? instead of print ... – Joey – 2011-04-18T23:06:37.947

Feel free to edit, I haven't programmed in BASIC for more than a decade. – ninjalj – 2011-04-18T23:11:56.787

Done :-). Tested now, even. – Joey – 2011-04-18T23:42:22.833

2You can drop the last quotation mark - QBasic will fix that for you! – steenbergh – 2018-12-23T09:07:03.933

You can get fewer points by using QBX. Score 31 – Joshua – 2014-09-16T18:53:10.330

3

H is for Haskell, 21 characters → Score: 28

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

PleaseStand

Posted 2011-04-18T20:41:31.673

Reputation: 5 369

3

S is for Scheme, 37 -> Score: 43

(display"abcdefghijklmnopqrstuvwxyz")

Lowjacker

Posted 2011-04-18T20:41:31.673

Reputation: 4 466

3

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

Sempie

Posted 2011-04-18T20:41:31.673

Reputation: 139

@manatwork do you happen to have that userscript lying around anywhere...? the dl link is borked :/ – cat – 2015-12-23T19:20:45.653

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 – 2015-12-23T19:34:41.463

You can remove 2 bytes (and obfuscate) by using ("").char in place of string.char. – cyclaminist – 2018-12-23T12:52:21.450

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 – 2014-10-20T10:17:44.327

1

Thanks. This way is much easier to spot out count mistakes: http://i.stack.imgur.com/qezQZ.png Seems you included in both cases the final newline character in the count. That is unnecessary.

– manatwork – 2014-10-20T10:29:31.583

2

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

BlackCap

Posted 2011-04-18T20:41:31.673

Reputation: 3 576

1Since a trailing newline is optional, you might as well drop the V to save a byte, and replace the p by P – oktupol – 2018-01-25T09:48:26.323

2

L is for Lua, 49 bytes → Score: 52

Previous answer for Lua had each letter printed on a new line. All on one line:

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

Try it online!

MCAdventure10

Posted 2011-04-18T20:41:31.673

Reputation: 103

2

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.

Dust

Posted 2011-04-18T20:41:31.673

Reputation: 131

2

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.

ovs

Posted 2011-04-18T20:41:31.673

Reputation: 21 408

2

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

leancz

Posted 2011-04-18T20:41:31.673

Reputation: 121

Or even : b ." abcdefghijklmnopqrstuvwxyz" ; at 36 characters – leancz – 2013-12-16T12:17:48.333

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 – 2013-12-17T09:46:47.660

@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 – 2013-12-17T10:12:26.020

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 – 2013-12-17T10:21:44.927

2

C++, 32 + 3penalty = 35

I could not find C++. So this is my option for it:

char a=96;while(a++<122)cout<<a;

the output is:

abcdefghijklmnopqrstuvwxyz

PS. It's my first golf, pls comment if i did something wrong

Straticiuc Vicu

Posted 2011-04-18T20:41:31.673

Reputation: 21

2

B is for Brachylog, 2 bytes → Score: 11

Ạẉ

Try it online!

Kroppeb

Posted 2011-04-18T20:41:31.673

Reputation: 1 558

2

C is for Cubix, 15 bytes, Score -> 20

uo)U"z`"-?@./;/

Try it online!

Cubified

    u o
    ) U
" z ` " - ? @ .
/ ; / . . . . .
    . .
    . .

Watch it run

MickyT

Posted 2011-04-18T20:41:31.673

Reputation: 11 735

2

K is for Keg, 3 + 3 bytes - > 6

azɧ

Try it online!

It seems that the rule disallowing newer languages to be posted has been removed. Let me know if this is somehow invalid.

Lyxal

Posted 2011-04-18T20:41:31.673

Reputation: 5 253

2

T is for Triangular, 19 bytes → 19+10 = 29

,5,D@"*i.jC>"dj>F+/

Try it online!

Ungolfed:

     , 
    5 , 
   D @ " 
  * i . j 
 C > " d j 
> F + /

The process here is,

  • Push 65
  • Push 27
  • j is a conditional NorthWest IP switch; it changes to NW if the top value of the stack is not 0. This means we have the equivalent of looping from 26 to 0 (because we decrement prior to entering the loop)
  • Decrement → j → Swap top 2 stack values → Print, don't pop → Increment → Swap → Repeat

This turns out to be 1 byte shorter with capital letters than lower case due to 97 being prime.

Reinstate Monica

Posted 2011-04-18T20:41:31.673

Reputation: 1 382

2

P is for Python 3, 32 chars -> Score: 38

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

I'm on fire. This is based in my 2011 answer which is before Python 3.5 added starred tuple unpacking, making it smaller that that one....

EXCEPT for Python 2 also got a smaller version today which is unbeatable :)

JBernardo

Posted 2011-04-18T20:41:31.673

Reputation: 1 659

2

PHP, 26 characters -> Score: 29

abcdefghijklmnopqrstuvwxyz

Gareth

Posted 2011-04-18T20:41:31.673

Reputation: 11 678

2

P is for PostScript, 29 chars → Score: 39

(abcdefghijklmnopqrstuvwxyz)=

Joey

Posted 2011-04-18T20:41:31.673

Reputation: 12 260

2

B, 45 -> Score: 46

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

Lowjacker

Posted 2011-04-18T20:41:31.673

Reputation: 4 466

2

m4, 26 characters -> Score: 28

abcdefghijklmnopqrstuvwxyz

(Hey, shinh lists it as a supported language)

ninjalj

Posted 2011-04-18T20:41:31.673

Reputation: 3 018

2

Xtal, 31 characters -> Score: 35

"abcdefghijklmnopqrstuvwxyz".p;

ninjalj

Posted 2011-04-18T20:41:31.673

Reputation: 3 018

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 – 2011-04-18T23:37:51.503

It's actually Xtal as used in golf.shinh.org: http://code.google.com/p/xtal-language/ , you can see some post-mortems at http://golf.shinh.org/l.rb?xtal

– ninjalj – 2011-04-18T23:48:12.420

2

E, 28 characters → Score: 29

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

Joey

Posted 2011-04-18T20:41:31.673

Reputation: 12 260

2

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

(print"abcdefghijklmnopqrstuvwxyz")

Jesse Millikan

Posted 2011-04-18T20:41:31.673

Reputation: 1 438

2

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

echo abcdefghijklmnopqrstuvwxyz

Jesse Millikan

Posted 2011-04-18T20:41:31.673

Reputation: 1 438

2

L#, 28 characters → Score: 30

"abcdefghijklmnopqrstuvwxyz"

Joey

Posted 2011-04-18T20:41:31.673

Reputation: 12 260

2

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

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

Jesse Millikan

Posted 2011-04-18T20:41:31.673

Reputation: 1 438

2

A is for awk: 37 characters -> score 40

BEGIN{for(i=96;i++<122;)printf"%c",i}

ninjalj

Posted 2011-04-18T20:41:31.673

Reputation: 3 018

2

U is for Unicon, 50 + 6 = 56

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

Joey Adams

Posted 2011-04-18T20:41:31.673

Reputation: 9 929

2

c,34 characaters -> score : 35

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

avinashse

Posted 2011-04-18T20:41:31.673

Reputation: 177

2putch 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 – 2011-04-20T16:35:56.340

@Joey: Shouldn't any C example be classified under the compiler name, then? – Joey – 2011-04-24T21:11:09.077

@Joey, @avinashse: I went ahead and reluctantly added this to the scoreboard. – Joey Adams – 2011-04-25T18:10:48.920

1talking 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 – 2014-07-14T20:13:25.977

2

G is for Groovy, 25 -> Score: 31

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

TheBigS

Posted 2011-04-18T20:41:31.673

Reputation: 151

2

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"

Gaffi

Posted 2011-04-18T20:41:31.673

Reputation: 3 411

3You 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 – 2014-07-15T12:57:51.400

2

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)

Koneke

Posted 2011-04-18T20:41:31.673

Reputation: 121

Are you sure this works in a version of Dyalog that predates the question? – lirtosiast – 2016-02-03T20:53:19.770

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 – 2016-02-03T21:30:32.283

Sounds good; I'd appreciate if you test it though. – lirtosiast – 2016-02-03T21:38:17.587

1

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 :) https://twitter.com/dyalogapl/status/695184773266960384

– Koneke – 2016-02-04T12:20:01.003

2

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.

Charles

Posted 2011-04-18T20:41:31.673

Reputation: 2 435

2

brainfuck, 60 -> 69

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

Try it online!

-2 bytes thanks to Dust

HyperNeutrino

Posted 2011-04-18T20:41:31.673

Reputation: 26 575

Consider doing the addition at the beginning (the first 3 chars) later in the code. You could golf 2 bytes with +++++[>+++++<-]>+>++++++++[>+++[>++++<-]<-]>>+<<<[>>>.+<<<-]. – Dust – 2018-01-28T09:09:50.217

2

A is for APL, 2 → 5

⎕a

Works on MicroAPL's APLX.

Adám

Posted 2011-04-18T20:41:31.673

Reputation: 37 779

1

S is for SmileBASIC, 39 37 bytes

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

snail_

Posted 2011-04-18T20:41:31.673

Reputation: 1 982

1I do not believe you have properly read the scoring rules for this challenge. Your score is the length of your code plus the length of the language name. – Pavel – 2017-02-03T06:25:53.267

Fixed, sorry. (padding) – snail_ – 2017-02-03T13:49:14.823

You can save 2 characters by adding 65 to the start/end of the loop. – 12Me21 – 2017-02-03T13:58:37.027

1

Y is for Yorick, 30+6 bytes → 36

system,"echo {a..z}|tr -d ' '"

BlackCap

Posted 2011-04-18T20:41:31.673

Reputation: 3 576

1

Z is for Zsh, 21+3 → 24 bytes

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

Try It Online!

BlackCap

Posted 2011-04-18T20:41:31.673

Reputation: 3 576

1

R is for R, 17 bytes Score -> 18

intToUtf8(97:122)

Try it online!

JayCe

Posted 2011-04-18T20:41:31.673

Reputation: 2 655

1

M is for M, 20 characters → Score: 21

let s={"a".."z"}in s

(M language reference)

Olly

Posted 2011-04-18T20:41:31.673

Reputation: 111

1

Z is for Z80Golf, 9 bytes + 7 = 16

00000000: 3e61 061a ff3c 10fc 76                   >a...<..v

Try it online!

According to the Web Archive, Z80Golf code golf machine was created (at least) in December 2007.

Disassembly

start:
  ld a, 97  ; the char to print
  ld b, 26  ; loop count
loop:
  rst $38   ; 1-byte alias for putchar
  inc a
  djnz loop ; decrement b and jump to `loop` if nonzero
  halt      ; end program

Bubbler

Posted 2011-04-18T20:41:31.673

Reputation: 16 616

1

I is for Io, 31 characters -> Score: 33

for($,65,90,$asCharacter print)

dingledooper

Posted 2011-04-18T20:41:31.673

Reputation: 421

1

F is for Fish, 16 bytes; score 20

"a"r:o1+:"{"=?;r

tjjfvi

Posted 2011-04-18T20:41:31.673

Reputation: 489

1

X is for x86, 9 bytes + 3 -> score 12

(or "x86 machine code" for 9 + 16 = 25)

b0 61 aa 40 3c 7a 76 fa  c3

This is a function, callable with void alpha(char edi[26]), like the x86-64 System V calling convention but in 32-bit mode. Or 16-bit mode (where 40 decodes as inc ax, otherwise the same).

The question says "program" that "prints", and this is neither of those things. I'm not sure this should count. Making a DOS .com executable out of this would take a few extra bytes, or the .text section of a Linux executable, including print and exit system calls. But there are several other answers (like some C++ ones) that are merely snippets that wouldn't even compile without #include<iostream> and int main(){.

I'm just going to follow modern codegolf defaults for I/O methods (Default for Code Golf: Input/Output methods) which include returning a string in the caller's buffer.


An x86-64 version would cost 1 extra byte for inc al or inc eax, and 3 extra characters in the language name. I could call it x64 but that implies Windows where the standard calling convention doesn't use RDI. But that's irrelevant, this is an asm / machine-code answer which doesn't care about being called from other languages. So anyway, I could say "x64" for a 10 + 3 = 13 version, but I hate that name because it goes with using "x86" to mean specifically 32-bit, instead of the whole ISA.

Ungolfed:

                machine code     NASM/FASM source
     1                         alpha:
     2 00000000 B061               mov  al, 'a'
     3                         .loop:               ; do {
     4 00000002 AA                 stosb              ; *edi++ = al
     5 00000003 40                 inc  eax           ; more compact than inc al
     6 00000004 3C7A               cmp  al, 'z'
     7 00000006 76FA               jbe  .loop       ; }while(al<='z')
     8 00000008 C3                 ret 

Try it online! with a FASM _start caller.


Justification: "x86 machine code" is as much a description as a name. Machine code is something you can program in and can be considered a family of languages. But those languages don't usually have names other than the ISA. I'd usually say "x86 32-bit machine code" when posting an answer like this, but that's just to make it clear the answer is the machine code, not the asm source text in the same listing.

Out of all ISAs, x86 is clearly recognizable as the name of this one. It's not a language that people regularly program in directly; usually we generate it from assembly language (or higher level languages).

"IA" (Intel Architecture) or "IA-32" are other common names for the ISA, so I could argue for a score of 11 in the letter "I". (But the only "x" answer is xtal at 35, so posting this as x86 is a more useful answer for reducing the total sum length across all letters.

Of course "x86" can be considered ambiguous between the machine code and assembly language. And without context it's not obviously a programming language because it's better known as the name of an ISA.

Peter Cordes

Posted 2011-04-18T20:41:31.673

Reputation: 2 810

I like this answer, it's a great intro to x86 assembly. I can't believe how few bytes each instruction takes. – Joey Adams – 2019-10-07T16:39:03.850

@JoeyAdams: There are special-case short forms for the accumulator (EAX / AX / AL), and instructions with implicit operands like stosb. In "normal" 32-bit code most instructions are 2 to 4 bytes long, or longer with larger addressing modes or SIMD opcodes... And 64-bit code needs a REX prefix on many instructions, making the avg instruction length more like 4 in compiler output. See Tips for golfing in x86/x64 machine code I just updated the source version with comments for the benefit of people who don't know x86 asm, since you mentioned it :P

– Peter Cordes – 2019-10-07T16:44:31.200

But yes, ISAs with variable-length instructions optimize for the most common cases. Original 8086's main bottleneck was code-fetch from memory so they put some care into that design. It's evolved over time into an ugly Frankenstein's monster though, with much lack of long-term thinking about ISA extensions. :( See Agner Fog's 2009 blog post, Stop the instruction set war

– Peter Cordes – 2019-10-07T16:50:09.370

1

P is for Pyth, 1 character -> Score: 5

G

Try it out!

That's it - just 1 letter. This is how it works:

  • The variable G is by default initialised to abcdefghijklmnopqrstuvwxyz in this language.
  • By default, the value returned by a program is printed out to the standard output.

John Red

Posted 2011-04-18T20:41:31.673

Reputation: 151

1

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

echo abcdefghijklmnopqrstuvwxyz

Joey

Posted 2011-04-18T20:41:31.673

Reputation: 12 260

1

Ada, 92 characters -> Score: 95

with ada.text_io;use ada.text_io;procedure a is begin put("abcdefghijklmnopqrstuvwxyz");end;

Gareth

Posted 2011-04-18T20:41:31.673

Reputation: 11 678

1

F is for F#, 36 characters -> Score: 38

printf("abcdefghijklmnopqrstuvwxyz")

Conrad Frix

Posted 2011-04-18T20:41:31.673

Reputation: 101

1

Tcl - 31 + 3 = 34

puts abcdefghijklmnopqrstuvwxyz

ninjalj

Posted 2011-04-18T20:41:31.673

Reputation: 3 018

My shortest iterative is longer, 45 :time {puts [format %c [expr [incr i]+96]]} 26 – sergiol – 2017-07-21T18:41:01.907

1

Wake, 33 bytes, score 37

all: "abcdefghijklmnopqrstuvwxyz"

ninjalj

Posted 2011-04-18T20:41:31.673

Reputation: 3 018

1

P is for PHP - 33 characters - Score: 36

echo implode("",range("a", "z"));

MisterBla

Posted 2011-04-18T20:41:31.673

Reputation: 181

1

V for VBA: 60

Sub VforVBA()
For i=1 To 26: a=a & Chr(64+i): Next: Debug.Print a
End Sub

Alex

Posted 2011-04-18T20:41:31.673

Reputation: 369

@Alex I think you can remove some spaces (i = 1, : a = a & Chr(64 + i), : Next: Debug) – Erik the Outgolfer – 2016-08-03T09:54:31.237

1Can you remove any of the spaces between the tokens? E.g. For i=1To26:a=a&Chr(64+i):Next:Debug.Print a – Joey Adams – 2014-07-15T17:44:50.867

@JoeyAdams edited as suggest – Alex – 2014-07-15T22:00:47.707

1Did you test this? Is "Fori" treated as "For i"? – Joey Adams – 2014-07-16T13:52:52.110

1@joeyAdams Yea you're correct, indeed the 1To26 and other parts won't work as well. I have changed it back to origin answer – Alex – 2014-07-16T14:08:54.800

1

C++: 32+3 = 35

char c=96;while(c++<122)cout<<c;

padawan

Posted 2011-04-18T20:41:31.673

Reputation: 294

I almost want to score this as 32, given that your code contains "c++". Alas, I didn't put this in the original rules. – Joey Adams – 2014-07-15T20:44:33.017

@JoeyAdams You're right, I corrected it :) – padawan – 2014-07-15T21:00:07.760

1

C is for Clojure - (39 or 53) + 7 = 46 or 60

No, it doesn't stand for C. In Clojure, all functions form closures, so I would argue this is a complete answer, in 39 bytes.

(doseq[c(range 97 123)](print(char c)))

But if you really want it with the main function, 53 bytes.

(defn -main[](doseq[c(range 97 123)](print(char c))))

But, this isn't a Clojuric way to solve this problem. Let's try something simpler (could be golfed for 4 bytes).

(print (apply str (map char (range 97 123))))

Much better, isn't it?

seequ

Posted 2011-04-18T20:41:31.673

Reputation: 1 714

1

U is for Unix Shell, 21 Characters → Score: 31

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

alphabot

Posted 2011-04-18T20:41:31.673

Reputation: 21

1

V is for VBScript, 40 Characters → Score: 48

for i=97 to 122:a=a+chr(i):next:MsgBox a

alphabot

Posted 2011-04-18T20:41:31.673

Reputation: 21

1

P is, in fact, for PHP - 23 chars / 27 score

<?=join('',range(a,z));

Aurel Bílý

Posted 2011-04-18T20:41:31.673

Reputation: 1 083

1

N is for Nu, 35 Characters → Score: 37

(puts 'abcdefghijklmnopqrstuvwxyz')

Gavin S. Yancey

Posted 2011-04-18T20:41:31.673

Reputation: 617

1

E, 26 characters → Score: 27

for x in'a'..'z'{print(x)}

This is based off Joey's answer.

Kevin Reid

Posted 2011-04-18T20:41:31.673

Reputation: 1 693

1

Python, 36 + 6 = 42

print''.join(map(chr,range(97,123)))

Not the shortest...

Fish Monitor

Posted 2011-04-18T20:41:31.673

Reputation: 111

1

N is for Nim, 31 → Score: 34

for x in'a'..'z':stdout.write x

Lynn

Posted 2011-04-18T20:41:31.673

Reputation: 55 648

1

S is for SMBF, 10 chars -> Score: 14

SMBF stands for Self-modifying Brainf***, and both names are used interchangeably. The original interpreters were named smbf.c and smbf.rb.

\x1a is a hex literal (a single non-printable ASCII character) for the decimal number 26.

<[-<.+>]a\x1a

The \x1a is used as a loop counter. a is printed and incremented each time.

mbomb007

Posted 2011-04-18T20:41:31.673

Reputation: 21 944

1

B is for Bash, 11 -> 15 24

echo {a..z}

echo {a..z}|tr -d \ 
                   ^
                 space

Scotow

Posted 2011-04-18T20:41:31.673

Reputation: 11

3

Already posted by Eelvex, but sadly it is not valid, because not produces the exact required output.

– manatwork – 2016-04-27T15:17:36.073

Don't take it the wrong way. Keep trying, keep posting. If you found this independently, you're very good. In the future, try answering less popular challenges. :-) – wizzwizz4 – 2016-04-28T16:59:37.660

ETHproductions, done. – Scotow – 2018-01-27T23:24:19.777

1

Mouse, 26 + 5 = 31

97a:(a.123<^a.&DUP !'1+a:)

Which outputs:

abcdefghijklmnopqrstuvwxyz

Note the lame way would be:

"abcdefghijklmnopqrstuvwxyz"

Which gets printed implicitly immediately (as string literals do, unfortunately), but it's 28 bytes.

cat

Posted 2011-04-18T20:41:31.673

Reputation: 4 989

1

J is for Java - score: 84 characters + 4 = 88

interface a{static void main(String[]A){for(char c=65;c<91;System.out.print(c++));}}

This prints ABCDEFGHIJKLMNOPQRSTUVWXYZ instead of abcdefghijklmnopqrstuvwxyz. If it's disallowed, one can simply set c to 97 (a) and loop until it reaches 123 ({) at the cost of one extra byte:

interface a{static void main(String[]A){for(char c=97;c<123;System.out.print(c++));}}

user8397947

Posted 2011-04-18T20:41:31.673

Reputation: 1 242

1

S is for seed7, 137 114 78 characters → Score: 83

const proc: main is func begin writeln("abcdefghijklmnopqrstuvwxyz");end func;

r3s1stanc3

Posted 2011-04-18T20:41:31.673

Reputation: 11

1

F is for Funge → 19 chars + 5 = 24

'\`#;1+::,"@9"+\`#@_;

Something that makes this unique is that it doesn't contain a single letter of the alphabet! Hence why I didn't shorten it by replacing "@9"+ with 'y. I'll take the points hit for it.

Try it with my interpreter here: BefungeSharp.

tngreene

Posted 2011-04-18T20:41:31.673

Reputation: 91

1

D is for D2, 2 + 6 = 8

!a[.+]

!a expand to 10 +, setting the current cell to 10 (a in base 36), and [.+] print the current cell as a base 36 string and increment the cell. Since the maximum value a cell can hold is 35, at 36 the cell is zeroed and the loop stop.

TuxCrafting

Posted 2011-04-18T20:41:31.673

Reputation: 4 547

1

S is for Swift, 76 characters -> Score: 81

var s=""
for i in 97...122{s.append((Character(UnicodeScalar(i))))}
print(s)

heratyian

Posted 2011-04-18T20:41:31.673

Reputation: 11

2Isn't it easier to just print a string containing the alphabet? – acrolith – 2016-10-21T16:41:36.323

Of course, but that just wouldn't be as fun – heratyian – 2016-10-21T17:57:10.383

my_string could be reduced to one letter. – pppery – 2019-09-22T18:41:11.930

good call @pppery – heratyian – 2019-09-23T17:27:24.497

You should update the bytecount after golfing your answer. – pppery – 2019-09-23T19:05:25.583

1

R, 26 bytes (score 27)

paste(letters,collapse="")

Output:

[1] "abcdefghijklmnopqrstuvwxyz"

rnso

Posted 2011-04-18T20:41:31.673

Reputation: 1 635

0

PHP, 26 + 3 = 29

<?=implode('',range(a,z));

jdstankosky

Posted 2011-04-18T20:41:31.673

Reputation: 1 474

0

B is for Bash, 25 bytes

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

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

Wossname

Posted 2011-04-18T20:41:31.673

Reputation: 221

0

R is for REXX, 15 characters → Score: 19

say xrange(a,z)

idrougge

Posted 2011-04-18T20:41:31.673

Reputation: 641

0

U is for uBASIC, 36 bytes → Score: 42

1 PRINT "abcdefghijklmnopqrstuvwxyz"

Try it online!

KSmarts

Posted 2011-04-18T20:41:31.673

Reputation: 1 830

0

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}

12Me21

Posted 2011-04-18T20:41:31.673

Reputation: 6 110

0

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

Taylor Scott

Posted 2011-04-18T20:41:31.673

Reputation: 6 709

0

U is for uBASIC, 30 + 6 = 36

Anonymous function that takes no input and outputs abcdefghijklmnopqrstuvwxyz

0?"abcdefghijklmnopqrstuvwxyz"

Try it online!

Taylor Scott

Posted 2011-04-18T20:41:31.673

Reputation: 6 709

0

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

12Me21

Posted 2011-04-18T20:41:31.673

Reputation: 6 110

0

I is for ICI, 37+3 bytes → 40

printf("abcdefghijklmnopqrstuvwxyz");

BlackCap

Posted 2011-04-18T20:41:31.673

Reputation: 3 576

0

I is for Io, 35+2 bytes → 37

"abcdefghijklmnopqrstuvwxyz"println

BlackCap

Posted 2011-04-18T20:41:31.673

Reputation: 3 576

0

AWK,33+3(Penalty)

END{for(;i<26;)printf"%c",97+i++}

Wasi

Posted 2011-04-18T20:41:31.673

Reputation: 1 682

0

JavaScript, 34 + 10 = 44

alert('abcdefghijklmnopqrstuvwxyz')

WallyWest

Posted 2011-04-18T20:41:31.673

Reputation: 6 949

alert(8337503854730415241050377135811259267835n.toString(36)) ;) – Kamil Kiełczewski – 2019-10-07T19:21:53.783

0

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

(princ"abcdefghijklmnopqrstuvwxyz")

Try it online!

Renzo

Posted 2011-04-18T20:41:31.673

Reputation: 2 260

0

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.

Veskah

Posted 2011-04-18T20:41:31.673

Reputation: 3 580

0

Z is for Zsh, 19 characters -> Score: 22

19 character solution thanks to @GammaFunction.

<<<${(j::):-{a..z}}

Another 18 character solution using Perl.

perl -eprint\ a..z

dingledooper

Posted 2011-04-18T20:41:31.673

Reputation: 421

1Not sure whether that would qualify for Zsh, it's more "Zsh+perl" (which would have a much larger penalty). You can get a pure Zsh answer in 19 characters, though: <<<${(j::):-{a..z}} – GammaFunction – 2019-09-26T09:05:35.773

0

F is for Forth (gforth), 26 + 5 = 31

'{ 'a [do] [i] emit [loop]

Try it online!

Two improvements over the submission by leancz 6 years ago:

  • An ASCII char prefixed with a quote gives the ASCII value of that char. So '{ saves a byte over 123. 'a is just for consistency.
  • The looping words including do and loop can't be used in interpreted mode, but gforth provides interpreted versions surrounded with brackets like [do] and [loop]. If a function uses three or less such words, using interpreted mode saves some bytes, as illustrated below.
\ using compiled mode
: a '{ 'a do i emit loop ; a
\ using interpreted mode
'{ 'a [do] [i] emit [loop]

Bubbler

Posted 2011-04-18T20:41:31.673

Reputation: 16 616

0

ink, 26 bytes

Glad to hear that newer languages are allowed.

abcdefghijklmnopqrstuvwxyz

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

Jelly, 2 bytes, score: 7

Jelly has a built-in.

Øa

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

Pyth, 1 byte, score: 5

Pyth has a shorter built-in than Jelly.

G

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

Canvas, 1 byte, score: 7

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

CJam, 7 bytes, score: 11

Learnt this language just for solving this problem.

'{,'a,-

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

Stax, 2 bytes, score: 6

Also, Stax has a built-in.

Va

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

Pip, 1 byte, score: 4

z

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

Gaia, 2 bytes, score: 6

₵a

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

MathGolf, 1 byte, score: 9

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

V (vim), 3 bytes, score: 4

¬az

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

Japt, 2 bytes, score: 6

;C

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

05AB1E, 1 byte, score: 7

A

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

Wren, 58 bytes

The iteration method

System.printAll((97..122).map{|i|String.fromCodePoint(i)})

Try it online!

Wren, 42 bytes

The boring method

System.print("abcdefghijklmnopqrstuvwxyz")

Try it online!

user85052

Posted 2011-04-18T20:41:31.673

Reputation:

0

vimscript

What does output mean?

Assuming output to the current vim buffer is ok:

:norm aabcdefghijklmnopqrstuvwxyz

Otherwise, output to stdout:

:!echo abcdefghijklmnopqrstuvwxyz

ninjalj

Posted 2011-04-18T20:41:31.673

Reputation: 3 018

0

P is for Powershell, 19 + 10 = 29

Because I'm bored at the moment, I hope you don't mind if I put up a quick PS that wouldn't have contended anyways...

97..122|%{[char]$_}

Simple char typecasting. You can shave off one byte by doing the alphabet in all caps.

65..90|%{[char]$_}

fuandon

Posted 2011-04-18T20:41:31.673

Reputation: 309

The output is wrong. This one outputs the alphabet with one character per line instead of all on one line. – Joey – 2019-10-31T20:26:51.693

0

H is for HTML -> 4+31

<HTML/>abcdefghijklmnopqrstuvwxyz

ps: browser will interpret the missing end tag

RMalke

Posted 2011-04-18T20:41:31.673

Reputation: 181

2ABCDEFGHIJKLMNOPQRSTUVWXYZ is far better at 30. – Erik the Outgolfer – 2016-08-03T09:52:59.533

0

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

"ABCDEFGHIJKLMNOPQRSTUVWXYZ

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

Timtech

Posted 2011-04-18T20:41:31.673

Reputation: 12 038

0

S is for Scala, Score: 40

print("abcdefghijklmnopqrstuvwxyz")

jamierocks

Posted 2011-04-18T20:41:31.673

Reputation: 551

0

Racket, 46 bytes (score 52)

(for((i 26))(display(integer->char(+ i 97))))

rnso

Posted 2011-04-18T20:41:31.673

Reputation: 1 635