75
\$\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

\$\endgroup\$
21
  • 2
    \$\begingroup\$ if one manages to make a single program that does not contain any vowel, do we need multiply the length of the program by 5? \$\endgroup\$ Commented Apr 24, 2012 at 10:55
  • 5
    \$\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
    Commented Apr 24, 2012 at 11:09
  • 10
    \$\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
    Commented Apr 24, 2012 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
    Commented Apr 24, 2012 at 21:17
  • 3
    \$\begingroup\$ I'm the OP. Uppercase not allowed. \$\endgroup\$
    – shamp00
    Commented Sep 17, 2016 at 5:21

123 Answers 123

2
\$\begingroup\$

Smalltalk (Squeak 4.x) 78 chars

Since we program by sending messages to objects, and that most messages are made of english words, this is a real challenge in Smalltalk.

However it is possible to exploit this curiosity: we can concatenate a String and a ByteArray with binary selector ,

'',#[97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122]

We can also exploit arithmetic on ByteArray to shorten to 78 chars

'',(#[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25]+97)

Now can we write a loop without using to:do: whileTrue: repeat?
Yes we can, with recursion, but we need to stop the recursion with a test, and can we without using one of ifTrue: ifFalse: or: and:?
Yes we can just implement the message of our choice in True/False.
Let's see how far we can go...

We can't use the receiver of a message, self has a vowel: so we need a message with two parameters, say x:z:, sent to any object (9 chars)

0x:''z:97

we implement x:z: message in Object (38 chars - 47 total)

x:x z:z z<123?[^0x:x,(#[0]+z)z:z+1].^x

we implement ? in class False (2 chars - 49 total):

?x

we implement ? in class True: (6 chars - 55 total)

?x^x x

But now, how to evauate the block without sending the message value (3 vowels)...
The best I could was to implement x in class BlockClosure: (16 chars - 71 total)

x<primitive:201>

But that still consumes 2 vowels... And we're not far from original 78...

I still got a nice obfuscation - golfing in Smalltalk is really contre-nature ;)

\$\endgroup\$
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!

\$\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
\$\endgroup\$
1
  • \$\begingroup\$ I was wondering when a Brainfuck solution would rear its head... +1 \$\endgroup\$ Commented Jun 2, 2015 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
\$\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

\$\endgroup\$
1
  • \$\begingroup\$ I think this is 94 bytes (unless there was whitespace originally that wasn't put into your answer). \$\endgroup\$
    – laurencevs
    Commented Sep 30, 2014 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
\$\endgroup\$
2
  • \$\begingroup\$ Not eligible to win as the question says “any language (which has a text-based syntax*)”, but nice one anyway. \$\endgroup\$
    – manatwork
    Commented Aug 18, 2015 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
    Commented Aug 18, 2015 at 13:17
2
\$\begingroup\$

Burlesque, 12 characters

'`'zr@[-\[sh

(see here in action.)

With a:

'a'zr@\[sh

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

Kotlin, 112 111 bytes

No E O U (29 bytes)

{('A'..'Z').map{println(it)}}

No A (39 bytes)

{(('B'-1)..'Z').filter{print(it);2>=1}}

No I (44 bytes)

{('A'..'Z').map{z->System.out.format(""+z)}}
\$\endgroup\$
2
\$\begingroup\$

Pyth - 1 Byte

G

Implicitly print alphabet

\$\endgroup\$
1
  • \$\begingroup\$ Implicitly Print Alphabet. IPA. \$\endgroup\$
    – user85052
    Commented Dec 14, 2019 at 13:44
2
\$\begingroup\$

Keg, 8 bytes (SBCS)

b;(|:1+

TIO

\$\endgroup\$
2
\$\begingroup\$

Keg, 7 bytes (SBCS)

\`zɧ^_^

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

\$\endgroup\$
2
\$\begingroup\$

Keg, 4 bytes

b;zɧ

Generates a range from a to z and prints it.

Try it online!

\$\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
\$\endgroup\$
2
\$\begingroup\$

W d, 5 4 bytes

(ÇL·

Explanation

After decompression:

'a    % Character a
  'z. % Up to character z
\$\endgroup\$
2
\$\begingroup\$

Vyxal, 3 bytes

kB∷

Try it Online!

Explanation:

kB   # Built-in constant "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
  ∷  # Second half of the string
     # Implicit output

Alternate 3 byte solution

kzṘ

Try it Online!

Explanation:

kz   # Built-in constant "zyxwvutsrqponmlkjihgfedcba"
  Ṙ  # Reverse the string
     # Implicit output
\$\endgroup\$
2
\$\begingroup\$

05AB1E, 4 bytes

žpRl

Try it online!

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

A
\$\endgroup\$
2
\$\begingroup\$

Vyxal, 3 bytes

kzṘ

Try it Online!

I cannot get more shorter than that. Sadly Vyxal is unable to beat Pyth here.

Fix thanks to @AUsername

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Read the challenge. One mustn't have a in it. kzṘ works tho \$\endgroup\$
    – emanresu A
    Commented May 29, 2021 at 1:46
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).

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

Lua, 56

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

\$\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
\$\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'
\$\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.

\$\endgroup\$
4
  • \$\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
    Commented Dec 12, 2013 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
    Commented Dec 12, 2013 at 21:55
  • \$\begingroup\$ Another variant of the 39-character script. Same length. 97..122|%{$s+=new-object string($_)};$s \$\endgroup\$
    – Iszi
    Commented Dec 12, 2013 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
    Commented Mar 4, 2014 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?

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

Forth, 46

.\" \x61bcd\x65fgh\x69jklmn\x6fpqrst\x75vwxyz"
\$\endgroup\$
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.

\$\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"
\$\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
\$\endgroup\$
2
  • 1
    \$\begingroup\$ CJam was created after this challenge was posted. \$\endgroup\$
    – lirtosiast
    Commented Aug 18, 2015 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
    Commented Aug 18, 2015 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'
\$\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.)

\$\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.

\$\endgroup\$

Your Answer

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

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