72
\$\begingroup\$

Inspiration: in 1939, a man named Ernest Vincent Wright wrote a novel called Gadsby without using the letter 'e'.

Your task is to write a set of (up to 5) programs in any language (which has a text-based syntax*) to output all 26 letters of the alphabet in order. However for each vowel aeiou, at least one of the programs must not include any occurrence of the vowel.

So there must be

  • a program that does not use 'a' or 'A' anywhere in the syntax of the program.
  • a program that does not use 'e' or 'E' anywhere in the syntax of the program.
  • a program that does not use 'i'  or 'I' anywhere in the syntax of the program.
  • a program that does not use 'o' or 'O' anywhere in the syntax of the program.
  • a program that does not use 'u' or 'U' anywhere in the syntax of the program.

All of them must output abcdefghijklmnopqrstuvwxyz.

The winner shall be the solution where the length of all programs is the shortest.

* since the constraint wouldn't be much of a challenge in Piet or Whitespace


Current rankings (06 Mar 2014):

The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

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

## Language Name, N bytes

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

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

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

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

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

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

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

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

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

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

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

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

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

}
body {
  text-align: left !important;
  display: block !important;
}

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

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

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">
<div id="language-list">
  <h2>Shortest Solution by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

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

\$\endgroup\$
  • 4
    \$\begingroup\$ @w0lf: No, it says "up to 5 programs" and "length of all programs", which I read as "there can be only one program and its length counts in this case". \$\endgroup\$ – schnaader Apr 24 '12 at 11:09
  • 9
    \$\begingroup\$ @PeterTaylor: You don't think having to avoid using vowels in your syntax is a unique challenge? As a JS programmer, it's especially interesting :) \$\endgroup\$ – mellamokb Apr 24 '12 at 13:51
  • 2
    \$\begingroup\$ Are newlines acceptable in the output (i.e. one per character)? I can shorten some of my code if that is the case... \$\endgroup\$ – Gaffi Apr 24 '12 at 21:17
  • 2
    \$\begingroup\$ Is uppercase output allowed? \$\endgroup\$ – Erik the Outgolfer Sep 16 '16 at 11:09
  • 2
    \$\begingroup\$ I'm the OP. Uppercase not allowed. \$\endgroup\$ – shamp00 Sep 17 '16 at 5:21

117 Answers 117

2
\$\begingroup\$

Sage CLI, 42

No e,i,o,u:

map(chr,[97..122])

No a,i,o:

'%c'*26%tuple([97..122])

Fun fact: str, chr, and cmp are the only Python builtins that don't contain vowels!

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Brainfuck, 31 bytes

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

How it works

-              wrap to 255
[----->++>+<<] loop 51 times  r1=102 r2=51
>----->+       r1=97 r2=52
[--<.+>]       loop 26 times and print letters a-z
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I was wondering when a Brainfuck solution would rear its head... +1 \$\endgroup\$ – WallyWest Jun 2 '15 at 6:02
2
\$\begingroup\$

Perl 5.10+, 23 chars

(This is an improvement on previous such entry but I don't have the reputaion to comment there):

no a, e, o, u:

print "\x61"..z

no e, i, o, u:

say a..z
| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Marbelous, 94 Bytes(I think)

.. @1 61 ..
.. .. // ..
.. Dn \\ ..
++ =0 \/ ..
@1 !! .. ..

:Dn
}0 .. 85 }0 }0
\\ {0 // {> {<

One program, no vowels, I think this qualifies as text-based, but I could be wrong. Marbelous interpreter

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I think this is 94 bytes (unless there was whitespace originally that wasn't put into your answer). \$\endgroup\$ – laurencevs Sep 30 '14 at 17:18
2
\$\begingroup\$

Piet, 104 (8x13) codels

Not eligible for this challenge, but I did it nonetheless.

enter image description here

I guess I could golf it a bit more, but this should be a good start.

output:

D:\codegolf\npiet-1.3a-win32>npiet "alphabet codegolf.png"
abcdefghijklmnopqrstuvwxyz
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Not eligible to win as the question says “any language (which has a text-based syntax*)”, but nice one anyway. \$\endgroup\$ – manatwork Aug 18 '15 at 13:09
  • \$\begingroup\$ I know. I did it just for the fun of it and wasn’t going for winning the challenge. :) \$\endgroup\$ – M L Aug 18 '15 at 13:17
2
\$\begingroup\$

Burlesque, 12 characters

'`'zr@[-\[sh

(see here in action.)

With a:

'a'zr@\[sh

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

05AB1E, 4 bytes (non-competing?)

žpRl

Try it online!

Doesn't use any vowel. If it were to use vowels, It'd be just this instead.

A
| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

JS (ES2018), 54 bytes

\141l\145rt`\141bcd\145fgh\151jklmn\157pqrst\165vwxyz`

Alerts "abcdefghijklmnopqrstuvwxyz".

So, you can update the JS score to 54 bytes.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Pyth - 1 Byte

G

Implicitly print alphabet

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Implicitly Print Alphabet. IPA. \$\endgroup\$ – user85052 Dec 14 '19 at 13:44
2
\$\begingroup\$

Keg, 8 bytes (SBCS)

b;(|:1+

TIO

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Keg, 7 bytes (SBCS)

\`zɧ^_^

This generates the range from backtick to z and removes the backtick character.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Keg, 4 bytes

b;zɧ

Generates a range from a to z and prints it.

Try it online!

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

W, 8 bytes

97;122.C

Pretty simple:

97;122.  % Generate a range from 97 ('a') to 122 ('z')
       C % Convert this to its character form
| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

W d, 5 4 bytes

(ÇL·

Explanation

After decompression:

'a    % Character a
  'z. % Up to character z
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

C 108

Technically cheating, but

x[]={1684234849,1751606885,1818978921,1886350957,1953722993,2021095029,31353};y(){z("%s",x);}

Compile with -Dy=main -Dz=printf (I counted those towards the char count). Of course if you're allowing -D, go full hog and say -Dp=main(c){for(;c<27;)putchar(96+c++);} 39 characters there. (Or one, depending on how you count).

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ With the same method, you could shorten a lot with "abcd%cfg.... \$\endgroup\$ – ugoren Jun 3 '12 at 19:55
  • \$\begingroup\$ Yes, but the the array was more intimidating. That's half comprehensible. \$\endgroup\$ – walpen Jun 3 '12 at 21:32
1
\$\begingroup\$

Lua, 56

_G["pr\105nt"]"\97bcd\101fgh\105jklmn\111pqrst\117vwxyz"

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Erlang escript 75

It's pretty hard to do any golfing in Erlang but anyway:

$ cat alphabet 

'm\x61\x69n'(_)->
'\x69\x6f':'f\x6frm\x61t'('l\x69sts':'s\x65q'(97,122)).

Note empty line at beginning of escript and also line break in main function. They are both mandatory. Run it using

$ escript alphabet
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

MATLAB, 17 characters

x='`':'z';x(2:27)

NOTE: Would be a winner with 7 characters if the first letter wasn't a vowel :-)

'a':'z'
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Powershell, 29 + 39 = 68 chars

If newlines are acceptable in the output (as has been asked in the question's comments), this can be further reduced to 51 chars.

Uses no 'eiou' (29 chars):

$s="";$s+=97..122|%{[char]$_}

Uses no 'au' (39 chars):

-join(97..122|%{new-object string($_)})

Both work off of the same concept of translating integers into their ASCII values, the first by an explicit cast to char and the second by using the string constructor to perform the cast implicitly.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ The "no eiou" solution doesn't output anything, and the variable has a bunch of spaces in it which weren't in the question spec. (Though, having not yet gotten an answer for newlines, I'm not sure we can assume any whitespace is out.) You'd need to add ;$s (3 characters) to make it output. \$\endgroup\$ – Iszi Dec 12 '13 at 21:52
  • 1
    \$\begingroup\$ That said, you could stick with the same principle and even shorten it by 3. 97..122|%{$s+=[char]$_};$s This also eliminates the spaces. \$\endgroup\$ – Iszi Dec 12 '13 at 21:55
  • \$\begingroup\$ Another variant of the 39-character script. Same length. 97..122|%{$s+=new-object string($_)};$s \$\endgroup\$ – Iszi Dec 12 '13 at 22:01
  • \$\begingroup\$ another modification to the first one which eliminate spaces $ofs='';"$(97..122|%{[char]$_})" however it adds an 'o' and is now 32 characters. \$\endgroup\$ – Tim Lewis Mar 4 '14 at 15:27
1
\$\begingroup\$

Python shell, 48 + enter

str('\x61bcd\x65fgh\x69jklmn\x6fpqrst\x75vwxyz')

Output:

'abcdefghijklmnppqrstuvwxyz'

If this is valid, I think my answer is too?

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Forth, 46

.\" \x61bcd\x65fgh\x69jklmn\x6fpqrst\x75vwxyz"
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

C (77)

Here's my crack at it. Dunno if I broke some kind of anti-compiler-flag rule, but here goes:

int main(){int i=97;while(++i<'{')if(i^'e'&&i^'i'&&i^'o'&&i^'u')putchar(i);

To compile and run:

$ gcc az.c -include "stdio.h" -o az
$ ./az
bcdfghjklmnpqrstvwxyz

In case anyone's interested, here's a quick explanation of some of the 'micro-optimizations':

97 is the decimal equivalent of 0x61, or 'a'. Used because it saves one char over 'a'.

'{' is the char immediately after 'z', it saves me an = (i<='z' vs i<'{').

A^B returns 0 when A and B are equal, and anything but when they aren't, which is as good as != for my purposes. It saves me four chars.

Loop starts out immediately ++'ing i to skip 'a' from the get-go, and save me an extra two chars. It saves me 9 chars altogether (exclude i^'a'&& and the i and ; I would've had to put had I incremented i within the block)

And finally, I used a compiler flag to include stdio.h instead of putting it in the file, saving me 18 chars. I don't know if this is "cheating" or anything, so feel free to point it out if it is.

P.S. This is my first code golf, so if I'm missing a rule, spoken or not, don't hesitate to correct me.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ This program uses the letters a and i (in main) and e, o, and u in if(i^'e'&&i^'i'&&i^'o'&&i^'u'). I suspect you've misunderstood the question. \$\endgroup\$ – Gareth Jan 30 '14 at 9:19
  • \$\begingroup\$ @Gareth I probably did. I interpreted the goal as to "make a program that prints every letter in the alphabet (sans a,e,i,o,u) in the shortest amount of code you can manage." \$\endgroup\$ – Braden Best Jan 30 '14 at 17:58
  • \$\begingroup\$ @Gareth Oh. Yes, I completely misunderstood the question. I thought the output was supposed to exclude vowels, but the source was fine including them. It was the other way around. \$\endgroup\$ – Braden Best Jan 30 '14 at 18:09
1
\$\begingroup\$

Bash, 31 chars

I think this is the shortest bash version so far:

z=({Z..z});tr -d \ <<<${z[@]:7}

This one outputs exactly abcdefghijklmnopqrstuvwxyz with no whitespace between any letters.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Clojure: 81 over 2 statements

No i, o, or u: 35 chars

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

No a or e: 46 chars

(str \u0061"bcd"\u0065"fghijklmnopqrstuvwxyz")

REPL (RPL?) session:

cd-glf-s-hrd> (apply str(map char(range 97 123)))
"abcdefghijklmnopqrstuvwxyz"
cd-glf-s-hrd> (str \u0061"bcd"\u0065"fghijklmnopqrstuvwxyz")
"abcdefghijklmnopqrstuvwxyz"
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Cjam 6

'{,97>
  • creates the character "{"
  • lists all characters less than "{" (this ends if you try to print it because character 0 stops things from outputting)
  • removes any with a value less than or equal to 97
| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ CJam was created after this challenge was posted. \$\endgroup\$ – lirtosiast Aug 18 '15 at 15:31
  • 1
    \$\begingroup\$ @ThomasKwa I realised that after having answered it. This disqualifies it from winning, but I think it is interesting enough it shouldn't be removed. \$\endgroup\$ – kaine Aug 18 '15 at 15:33
1
\$\begingroup\$

T-SQL, 120 (65+55)

This answer assumes results of both PRINT and SELECT are allowed as output.

65 characters without e, o, u:

PRINT'abcd'+CHAR(101)+'fghijklmn'+RTRIM(0x6F707172737475)+'vwxyz'

55 characters without a, i:

SELECT LEFT(0x616263646566676869,9)+'jklmnopqrstuvwxyz'
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Haskell (interpreted), 17

[['`'..]!!1..'z']

Back-quote comes before 'a', so a is the second element of the sequence starting with back-quote. This is then just the sequence from a to z.

This is technically a naked Haskell expression. (If you save it to ".ghci", though, running ghci will print the alphabet.)

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

><>, 35 bytes

!v99*:f1++$ff++31p!
 >: 1+:bb*1+)?;

><> outputs with the command 'o', hopefully it also provides introspection capability so we'll just edit the code at runtime to add the 'o'. This is done with the command 'p' at the end of the first line.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Simplex v.0.7, 3 bytes

Noncompeting, as Simplex postdates question

^lg
^l  ~~ sets current byte to the alphabet [a-z]
  g ~~ output as string
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

F# (96) characters, using fsharpi

// Without u (48 chars)
sprintf "abcdefghijklmnopqrst%cvwxyz" (char 117)

// Without a, e, i, o (48 chars)
"\u0061bcd\u0065fgh\u0069jklmn\u006fpqrstuvwxyz"

This was tough since all the functions to manipulate sequences contain vowels. Also the functions for outputting to stdout are printf and printfn, therefore this only produces a string instead of writing it out.

These lines will need to be ran through the F# interpreter and ended with ;; to execute.

| improve this answer | |
\$\endgroup\$

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