| Bytes | Lang | Time | Link |
|---|---|---|---|
| 078 | R | 250827T191148Z | M-- |
| 099 | Go | 250827T135422Z | bigyihsu |
| 017 | Vyxal 3 | 250827T122118Z | Themooni |
| 073 | AWK | 250826T141914Z | xrs |
| 029 | Ly | 230926T054328Z | cnamejj |
| 076 | C | 230922T034743Z | Martin K |
| 015 | Vyxal | 210712T104458Z | emanresu |
| 054 | sed | 230922T060528Z | Philippo |
| 047 | ReRegex | 230922T033959Z | ATaco |
| 060 | JavaScript ES6 | 161006T035422Z | Grax32 |
| 017 | Japt R | 210712T101924Z | Shaggy |
| 053 | Julia 1.0 | 210712T111507Z | MarcMush |
| 066 | Java JDK | 210712T110307Z | Olivier |
| 047 | PowerShell 6 | 190306T185845Z | GMills |
| 029 | APL Dyalog Unicode | 190306T193953Z | ngn |
| 016 | Stax | 190306T193818Z | recursiv |
| 071 | R | 161001T140531Z | plannapu |
| 020 | MathGolf | 190306T133716Z | maxb |
| 045 | ><> | 190306T122739Z | Emigna |
| 056 | PowerShell | 190306T074101Z | mazzy |
| 090 | PHP | 160930T183539Z | Paper |
| 104 | Java | 161002T174629Z | user1893 |
| 032 | Vim | 161011T124518Z | udioica |
| 041 | q | 161011T031951Z | Boston W |
| 050 | PHP | 161003T101455Z | aross |
| 037 | Perl | 160930T193524Z | Dada |
| 052 | ><> | 161003T100905Z | Sok |
| 054 | Ruby | 161001T151400Z | pgks |
| 085 | GameMaker Language | 161002T171629Z | Timtech |
| 024 | Japt | 160930T193840Z | ETHprodu |
| 088 | ListSharp | 161002T154557Z | downrep_ |
| 086 | TIBasic | 161002T164757Z | Timtech |
| 057 | Cheddar | 161002T163729Z | Conor O& |
| 154 | Clojure | 161002T154035Z | Carcigen |
| 071 | Julia | 161002T103854Z | Frames C |
| 056 | Fourier | 161002T085625Z | Beta Dec |
| 117 | Brainfuck | 161002T071358Z | Sp3000 |
| 026 | CJam | 161002T001750Z | Sp3000 |
| 031 | CJam | 161001T134639Z | Neorej |
| 060 | Haskell | 161001T133207Z | Laikoni |
| 173 | Racket | 161001T124323Z | rnso |
| 065 | JavaScript ES6 | 160930T200035Z | ETHprodu |
| 064 | PHP | 160930T193126Z | Ismael M |
| 062 | /// | 161001T070522Z | Erik the |
| 157 | Brainfuck | 160930T205346Z | gtwebb |
| 146 | R | 160930T195118Z | pajonk |
| 057 | Ruby | 160930T220134Z | Level Ri |
| 063 | Python 2.7 | 160930T185647Z | lynn |
| 019 | Pip | 160930T211245Z | DLosc |
| 085 | Forth | 160930T210814Z | mbomb007 |
| nan | C | 160930T191026Z | musarith |
| 025 | Pyth | 160930T204015Z | TheBikin |
| 040 | Vim | 160930T180353Z | DJMcMayh |
| 017 | Pyke | 160930T194910Z | Blue |
| 029 | MATL | 160930T180810Z | Suever |
| 018 | Jelly | 160930T175054Z | Dennis |
| 062 | PHP | 160930T184335Z | Jör |
| 036 | Bash + GNU utilities | 160930T175741Z | Digital |
| 067 | PowerShell v3+ | 160930T180800Z | AdmBorkB |
| 074 | JavaScript ES6 | 160930T190123Z | Neil |
| 043 | Retina | 160930T184202Z | ETHprodu |
| 070 | Cheddar | 160930T175423Z | Downgoat |
| 046 | q | 160930T180718Z | skeevey |
| 016 | 05AB1E | 160930T175814Z | Adnan |
R, 78 bytes
f=paste0;cat(gsub("(H|Q|T|W)","\n\\1",f(f(LETTERS,collapse=", "),"."),perl=T))
Inspired by GMills answer in Powershell.
Go, 99 bytes
func()string{return`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, Z.`}
Returning the original string is the most boring answer.
Go, 96 bytes
import."fmt"
func f(){for c:=1;c<26;c++{Printf("%c,%c",c+64," \n"[4784256>>c&1])}
Println("Z.")}
A port of Martin Kealey's answer is the 3 bytes shorter than the above and loses 20 bytes from imports, Println vs puts, and adjusting the bit shift to account for the fact that Golang doesn't have the ">> mods by integer size" assumption.
Vyxal 3, 17 bytes
m¨',+⑧ᏜZ.≜Ꮠ≜②dfϢ'
m¨',+⑧ᏜZ.≜Ꮠ≜②dfϢ'
m # uppercase alphabet
¨ # to each:
',+ # append a comma
≜ # replace
⑧ # the last element with
ᏜZ. # literal string "Z."
Ϣ # chunk by
f # digits of
Ꮠ≜②d # 79334
' # join sublists on space, then on newlines.
💎
Created with the help of Luminespire.
<script type="vyxal3">
m¨',+⑧ᏜZ.≜Ꮠ≜②dfϢ'</script>
<script>
args=[]
</script>
<script src="https://themoonisacheese.github.io/snippeterpreter/snippet.js" type="module"/>
AWK, 73 bytes
END{for(;i++<25;$i~/[HQTW]/&&$i=RS$i)$i=sprintf("%c,",i+64);print$0" Z."}
Ly, 29 bytes
'A043397[[r:o`r' ',oo,]p9`o];
This code pushes the number of letters to print on each line onto the stack. It also keeps the current character on the end of the stack, iterating it each time it prints. The code loops until the "number of letters to print on the next line" is zero.
'A - push "A" on the stack
0 - add 0 divider to stop loop
43397 - push number of chars per line
[ ] - loop while number of chars>0
[ ,] - loop for one line of chars
r - reverse stack
: - duplicate current char
o - print
` - increment to next char
r - reverse stack again
' ',oo - push/print " ,"
p - delete iterator var
9`o - push/print LF
; - exit to abandon junk on stack
C (76 bytes)
c;main(){for(c=64;++c<90;)printf("%c,%c",c," \n"[4784256>>c&1]);puts("Z.");}
This relies on
- implicit-
intdeclarations (forc,main,putsandprintfwithout#include<stdio.h>); - ASCII;
>>being modulo the size of an integer in bits, either 32 or 64, so thatX>>'A'gives "Xshifted by 1" andX>>'Z'gives "Xshifted by 26".
4784256 is 2⁷+2¹⁶+2¹⁹+2²² (or equivalently 1<<7 | 1<<16 | 1<<19 | 1<<22), because 'G', 'P', 'S', and 'V' are respectively the 7th, 16th, 19th, and 22nd letters of the alphabet.
Vyxal, 15 bytes
n\,Ẋ7933fẇ⁋Ṫ\.+
Try it Online! -2 thanks to lyxal. -1 thanks to ffseq
n # Uppercase alphabet
Ẋ # Each prepended to
\, # ","
ẇ # Cut into chunks of lengths
7933f # Digits of 7933 (+ rest, which is 4)
⁋ # Join by newlines
Ṫ # Remove the last character
\.+ # Append a dot
sed, 54 bytes
No further tricks take us down, I'm afraid:
s/^/ABCDEFG\
HIJKLMNOP\
QRS\
TUV\
WXYZ./
s/[A-Y]/&, /g
ReRegex, 47 bytes
-/,\n/\w\B/$0, /ABCDEFG-HIJKLMNOP-QRS-TUV-WXYZ.
Ungolfed
-/,\n/ # Replace all dashes with a comma and newline
\w\B/$0, / # Replace all letters preceeding a letter with itself and a comma space.
ABCDEFG-HIJKLMNOP-QRS-TUV-WXYZ. # The default code.
JavaScript (ES6), 66 64 60 bytes
_=>`ABCDEFG
HIJKLMNOP
QRS
TUV
WXY`.replace(/./g,"$&, ")+"Z."
Regex matches the characters but not the carriage returns, so, using regex replace, I can add the ", " to each character.
Edit: Removed 2 characters thanks to ETHProductions
Edit: Changed from CRLF to LF, thanks @Olivier Grégoire
Japt -R, 17 bytes
;LiB¬q,ú2¹óÏk`qw
;LiB¬q,ú2¹óÏk`qw
;L :"."
i :Prepend
; B : Uppercase alphabet
¬ : Split
q : Join with
,ú2 : "," right padded with spaces to length 2
¹ :End prepend
ó :Partition before characters that return a falsey value (empty string)
Ï :When passed through the following function
k : Case insensitively remove
`qw : Characters in the compressed string "qthw"
:Implicit output joined with newlines
Java (JDK), 66 bytes
v->"ABCDEFG\nHIJKLMNOP\nQRS\nTUV\nWXY".replaceAll(".","$0, ")+"Z."
PowerShell 6, 53 52 47 bytes
"$('A'..'Y'|%{"$_,"-replace'[HQTW]','
$&'}) Z."
I believe PowerShell 6 is newer than this challenge. Originally posted as a suggestion for @mazzy's solution.
APL (Dyalog Unicode), 30 29 bytesSBCS
Full program.
↑'AHQTW'(∊⍨⊂⊢)'.',⍨∊', '∘,¨⎕a
⎕a the uppercase alphabet
', '∘,¨ prepend ", " to each letter
∊ ϵnlist (flatten)
'.',⍨ append a period
'AHQTW'(…) apply the following tacit function with the string as left argument:
⊢ the right argument (", A, B…")
⊂ partitioned so a new partition begins at each True in
∊⍨ the Boolean mask indicating argument elements that are members of the left argument
↑ mix the list of strings into a character matrix
Stax, 16 bytes
é╡₧!D☻àw╟`«▒Σ╪░↓
Unpacked, ungolfed, and commented, it looks like this.
'. push "."
VA push "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
',\ repeat zip alphabet with comma, yielding ["A,", "B,", ...]
J join with spaces
) overwrite end of joined string with period (pushed first)
"r!WEF"! crammed array literal for [20, 47, 56, 65]
A& assign 10 to these array indices. 10 is the codepoint for newline.
R, 83 71 bytes
a=rbind(LETTERS[-26],","," ");a[3,7+3*c(0,3:5)]="\n";cat(a,"Z.",sep="")
Makes a matrix of 3 rows (one with the letters, one with the commas and the other with either a space or a newline).
Edit: Thanks Billywob!
MathGolf, 20 bytes
'A[793∙]öæ└╣·\n\\;'.
Explanation
'A Push "A"
[793∙] Push [7, 9, 3, 3, 3]
ö Start foreach-loop over index array using next 7 instructions
æ Start for-loop for current item of index array, using next 4 instructions
└ Duplicate and increment, e.g. "A" -> "A", "B"
╣· Push ", "
\ Swap top two, keeping the letter on top after inner loop
n\ Push newline and swap top two, keeping the letter on top
\;'. Swap top two, discard top, and push "." (remove trailing comma)
PHP, 90 chars
A<?for($i=66;$i<91;$i++){echo", ";if(in_array($i,[72,81,84,87]))echo"\n";echo chr($i);}?>.
I know it's longer than 77 chars, but this is as short as it gets.
Java, 116 109 105 104
String f(){String s="";for(char c=65;c<91;)s=s+c+(c>89?46:',')+("GPSV".indexOf(c++)<0?' ':10);return s;}
Ungolfed:
String f() {
String s = "";
for (char c = 65; c < 91;) {
s = s + c
+ (c > 89 ? 46 : ',')
+ ("GPSV".indexOf(c++) < 0 ? ' ' : 10);
}
return s;
}
Vim, 32 bytes
26o<C-V><C-V>64,<Esc>r.V{g<C-A>8Jj9Jj3Jj.j4JcH<C-R>"
Leaves a blank line at the end, which was allowed, but it's weird being this clumsy. Even worse, I'm ending in insert mode. I've seen some other folks do it here, so I guess it's allowed? It feels dirty.
26o<C-V><C-V>64,<Esc>: The first<C-V>makes the second one insert literally. The<C-V>64s this leaves in the buffer will be turned into ASCII code points, then into letters. Commas already in.r.: Never going to be at the end again, so do the.now.V{g<C-A>: Uses visual increment to turn all the64s into the ASCII code points of the capital letters.8Jj9Jj3Jj.j4J: The arbitrary line joins. First one is8Jinstead of7Jbecause we're dealing with the blank line. The repeated3Js are eligible for a dot repeat.cH<C-R>": People usually think ofi<C-R>as an insert mode paste, but it's more like an insert mode macro. Stuff like<C-V>65will run as if typed, and interpreted as a decimal code point. This leaves an extra (allowed) line at the end, and stays in insert mode.
q, 41 bytes
@[", "sv,:'[.Q.A];20 47 56 65;:;"\n"],"."
How it works:
.Q.A / Built-in alphabet
,:'[ ] / Flip data (to 1-row matrix)
", "sv / Join with ", "
@[ ;20 47 56 65;:;"\n"] / Replace spaces with newlines at indices
,"." / Append period
PHP, 61 58 55 50 bytes
Note: uses Windows 1252 encoding.
for($a=A;$a<Z;)echo"$a,",~ßõ[!trim($a++,GPSV)]?>Z.
Run like this:
php -r 'for($a=A;$a<Z;)echo"$a,",~ßõ[!trim($a++,GPSV)]?>Z.' 2>/dev/null;echo
If your terminal is set to UTF-8, this shows that it works:
php -r 'for($a=A;$a<Z;)echo"$a,"," \n"[!trim($a++,GPSV)]?>Z.' 2>/dev/null;echo
Explanation
Iterates over the alphabet until Y is reached. Prints the letter with a comma, then prints a space, unless the letter is one of GPSV (found by !trim($a,"GPSV")). After the loop, print Z..
Tweaks
- Saved 3 bytes by using
strposinstead of char count - Saved 3 bytes by using trim instead of strpos
- Saved 5 bytes by using the closing tag to print a literal
Z.instead ofecho
Perl, 37 bytes
Credits to @Dom Hastings for this solution (3 bytes shorter than mine, see bellow).
say+(map"$_, ".$/x/[GPSV]/,A..Y),"Z."
Run with -E (or -M5.010) flag :
perl -E 'say+(map"$_, ".$/x/[GPSV]/,A..Y),"Z."'
My previous version, 3 bytes longer (total of 40 bytes) :
perl -E '$_=join", ",A..Z;s/[HQTW]/\n$&/g;say"$_."'
Ruby, 56 54 bytes
$><<(?A..?Y).map{|c|c+('GPSV'[c]?",
":", ")}.join+"Z."
The first line ends with a literal newline.
Edit: saved two bytes by replacing 'A'..'Y' with ?A..?Y.
GameMaker Language, 85 bytes
b=""for(a=65;a<90;a++){d=chr(a)c=", "if string_pos(d,"GPSV")c=",#"b+=d+c}return b+"Z.
Boring alternate (94 bytes)
return string_replace_all("AaBaCaDaEaFaG,#HaIaJaKaLaMaNaOaP,#QaRaS,#TaUaV,#WaXaYaZ.","a",", ")
Pretty straightforward. Note that # is newline literal (think \n in most languages). Use \# for #.
Japt, 24 bytes
;B¬qJ+S r"[HQTW]"@R+XÃ+L
How it works
; // Reset various variables. B is set to "ABC...XYZ", J is set to ",", and L is set to ".".
B¬ // Take the uppercase alphabet and split into chars.
qJ+S // Join with ", ".
r"[HQTW]" // Replace each H, Q, T, or W with
@R+XÃ // a newline plus the character.
+L // Append a period to the result.
// Implicit: output last expression
ListSharp, 88 bytes
SHOW="A, B, C, D, E, F, G,\nH, I, J, K, L, M, N, O, P,\nQ, R, S,\nT, U, V,\nW, X, Y, Z."
TI-Basic, 86 bytes
Cheers to anyone who can compress it further :3
Disp "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, Z.
Cheddar, 57 bytes
->(65@"90).sub(/[GPSV]/g,"$0
").sub(/[^Z\n]/g,"$0, ")+"."
Try it online! Isn't that beautiful? It's a nice rectangle.
Two regex substitutions. (65@"90) is the uppercase alphabet, .sub(/[GPSV]/g,"$0\n") replaces GPSV with itself and "\n", .sub(/[^Z\n]/g,"$0, ") replaces all non newline and Z characters with itself and ", ", and "." adds a final ..
Clojure, 154 bytes
#(print(loop[a(map char(range 65 91))[c & d][7 9 3 3 4]s""](if c(let[[l r](split-at c a)e(if d\,\.)](recur r d(str s(clojure.string/join", "l)e"\n")))s)))
That call to clojure.string/join is killer, although this wasn't competitive to begin with. Basically, it cuts the generated alphabet string a at the predefined line lengths, then adds each line to the acc.
It would have been significantly shorter for me to just "cheat" and print the string (91 bytes):
(print "A, B, C, D, E, F, G,\nH, I, J, K, L, M, N, O, P,\nQ, R, S,\nT, U, V,\nW, X, Y, Z.")
But where's the fun in that?
Ungolfed:
(defn abcs []
(print
(loop [alpha (map char (range 65 91))
[c & cuts] [7 9 3 3 4]
acc ""]
(if c
(let [[a-line a-rest] (split-at c alpha)
e (if cuts \, \.)]
(recur a-rest cuts (str acc (clojure.string/join ", " a-line) e "\n")))
acc))))
Julia, 71 bytes
f()=join(join.(['A':'G','H':'P',"QRS","TUV","WXYZ"],[", "]),",\n")*"."
Requires 0.5 or better for broadcasting .()
Fourier, 56 bytes
|~S44a32aS^|f|(iaf~i)10a|L65~i72L81L84L87L90(iaf~i)ia46a
Again, uses functions to take out repeated parts of the code.
Brainfuck, 117 bytes
+[++[-<]-[->->]<]+++[->++>+++>+>+<<<<<--<<->>>]>+[[-<<<<<+.>-.+>.>>>]>[[-<+>]>]<<[<]<.>>]<<-[---<<<+.>-.+>.>]<<<+.>+.
The first four lines each have a trailing space, and the program assumes 8-bit cells. Try it online!
(Handling the last line is tricky...)
CJam, 26 bytes
'A79333Ab{{',S2$)}*N\}/'.@
'A Push 'A'
79333Ab Push [7 9 3 3 3]
{ }/ For each number n in the previous array...
{ }* Execute n times...
',S Push a comma and a space
2$) Copy last letter and increment
N\ Place a newline under the letter on top
'.@ Push '.' and rotate
CJam, 31 bytes
'[,65>", "*7933Ab{3*/(\:+}%N*'.
Explanation:
'[,65> push uppercase alphabet
", "* ", " between all letters
7933Ab push [7 9 3 3]
{3*/(\:+}% slices of lengths 21, 27, 9, 9
N*'. join slices with newlines, add final "."
Haskell, 60 bytes
putStr$(['A'..'Y']>>= \x->x:", "++['\n'|elem x"GPSV"])++"Z."
putStr$(['A'..'Y']>>= \x->x:", "++['\n'|elem x"GPSV"])++"Z."
['A'..'Y'] --String "ABC...XY"
\x->x:", "++['\n'|elem x"GPSV"] --function to append ", " and a "\n" when needed
( >>= ) --map function over the string and concat
++"Z."--append "Z."
putStr$ --print
Racket 173 bytes
(λ()(let((l(list 7 9 3 3 4))(s 65))(for((i 5))(define e(+ s(list-ref l i)))(for((j(range s e)))
(printf"~a~a "(integer->char j)(if(= j 90)"."",")))(printf"~n")(set! s e))))
Ungolfed:
(define f
(λ()
(let ((l (list 7 9 3 3 4))
(s 65))
(for ((i 5))
(define e (+ s (list-ref l i)))
(for ((j (range s e)))
(printf "~a~a " (integer->char j) (if(= j 90) "." ",")))
(printf "~n")
(set! s e)
))))
Testing:
(f)
Output:
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, Z.
JavaScript (ES6), 66 65 bytes
Beating @Neil was impossible... That's why I did it. :-)
f=(i=10)=>i>34?"z.":i.toString(++i)+","+`
`[9568512>>i-9&1]+f(i)
Golfed 1 byte thanks to a trick from @LevelRiverSt. Using String.fromCharCode is 7 bytes longer:
f=(i=65)=>i>89?"Z.":String.fromCharCode(i,44,i%86%83%80%71?32:10)+f(i+1)
How it works
This recursively generates each character of the alphabet from a to y, using .toString(). A comma is appended after each letter, plus a newline if 9568512>>i-9&1 is 1, or a space otherwise. When the recursion gets past 34, i.e. to z, the function simply returns "z.".
PHP, 67 65 64 bytes
Not exactly short, but it works.
This assumes that all errors are going to stderr.
foreach(range(A,Z)as$C)echo$C,",."[$C>Y],"
"[!strstr(GPSV,$C)];
You can try it on http://ideone.com/VSK8Yu.
Thanks to @Jörg Hülsermann for saving 2 bytes! And thanks to @Titus for saving me 1 byte!
///, 62 bytes
/c/, /AcBcCcDcEcFcG,
HcIcJcKcLcMcNcOcP,
QcRcS,
TcUcV,
WcXcYcZ.
Not much to golf here, but I reduced it from 77 bytes to 62 just by replacing , with c.
Brainfuck, 157 bytes
+++++[>+>+++<<-]>>[->+>++++>+++>++<<<<]>----->+++++.>-.>++.<<<<<+[->>>+.>.>.<<<<<]+++++++++>>.<<[->>>+.>.>.<<<<<]<---[+>+++>>.<<[->>>+.>.>.<<<<<]<]>>>>+.>++.
R, 146 bytes
L=LETTERS
f=function(x,y=""){paste(x,collapse=paste0(", ",y))}
cat(f(c(f(L[1:7]),f(L[8:16]),f(L[17:19]),f(L[20:22]),f(L[23:26])),"\n"),".",sep="")
Explanation:
LETTERS is predefined for uppercase letters.
The f function is for concatenating vector x on , with additional y (used for newlines).
The cat is the used as it prints \n as newlines. f is called on the letters to form rows and then on the rows again to form the whole output.
Probably golfable - I don't like the multiple calls of f...
Ruby, 57 bytes
26.times{|i|$><<(i+65).chr+",."[i/25]+"
"[2392128>>i&1]}
The space at the end of the first line is required: it's a literal [space][newline.]
C,74 bytes
c;main(){for(;++c<27;)printf("%c%c%c",64+c,44+c/26*2,4784256>>c&1?10:32);}
Basic bitshift and mask to determine when to print a space and when to print a newline. I noted that with the A and Z removed all groups are a multiple of 3 letters long, but I was unable to make use of this.
Python 2.7, 67 66 63 bytes
a=65;exec"print'%c'%a+',.'[a>89]+'\\n'[a%42%39%9^2:],;a+=1;"*26
Dennis saved a byte.
Pip, 19 bytes
18 bytes of code, +1 for the -n flag. Outputs in lowercase.
(zJk).'.^@A*"?09B"
The ? represents a non-printing character, ASCII code 21. Try it online!
Explanation
z Lowercase alphabet
Jk Join on ", "
( ).'. Append a period
A*"?09B" Map ascval() over that string, results in list: [21 48 57 66]
^@ Split at those indices
Join on newline and print (implicit, -n flag)
Forth, 85 bytes
This is a function that prints the string. Checking for when to print a new line is costly. This is still shorter than simply printing the required string, because it has new lines in it. The code does not need to be on this many lines, but there does need to be a line break within the DO LOOP somewhere. I don't know why.
: f 90 65 DO
I 72 = I 81 = I 84 = I 87 = + + +
if CR then
I emit ." , "
LOOP ." Z." ;
The code is case-insensitive.
C, 112 102 81 bytes
Thanks to cleblanc & LevelRiverSt!
i,c;main(){for(c=64;++c<91;)printf("%c%c%c",c,44+c/90*2,c=="GPSVZ"[i]?++i,10:32);}
Pyth, 25 bytes
+Pjmj\ dc*G\,j94092 23)\.
A program that prints the result to STDOUT.
How it works
+Pjmj\ dc*G\,j94092 23)\. Program. Input: none
G Yield string literal'abcdefghijklmnopqrstuvwxyz'
* \, Cartesian product of that with ',', yielding a list of
characters with appended commas
j94092 23) Yield the integer 94092 in base-23, giving [7, 16, 19, 22]
c Split the comma-appended character list at those indices
mj\ Join each element of that on spaces
j Join that on newlines
P All but the last element of that, removing trailing ','
+ \. Append '.'
Implicitly print
Vim, 42, 40 keystrokes/bytes
:h<_<cr>jjYZZP:s/./&, /g<cr>7f r<cr>9;.3;.3;.$ch.
Thanks to Lynn and her awesome vim answer for the tip to grab the alphabet from help.
Thanks to RomanGräf for saving two bytes!
Explanation:
:h<_<cr> " Open up vim-help
jj " Move down two lines
Y " Yank this line (containing the alphabet)
ZZ " Close this buffer
P " Paste the line we just yanked
:s/./&, /g<cr> " Replace every character with that character followed by a comma and a space
7f " Find the seven space on this line
r<cr> " And replace it with a newline
9; " Repeat the last search (space) 9 times
. " Repeat the last edit (replace with a newline)
3; " Third space
. " Replace with newline
3; " Third space
. " Replace with newline
Then, we move the end of the of the line with $, change back a character with ch and insert a dot.
Pyke, 23 19 17 bytes
G\,J\.+2cu /P
G\,J\.+ - ",".join(alphabet)+"."
2c - split(^, size=2)
/ - split_sized(^, V)
u - yield list [7,9,3,3] (actual bytes `u%04%07%09%03%03`)
P - print(^)
MATL, 38 29 bytes
9 bytes saved thanks to @Luis!
1Y2X{', '&Zc46h1[CEII]I*11hY{
Explanation
1Y2 % Push the upper-case alphabet to the stack
X{ % Break the character array into a cell array (similar to a list)
% where each element is a letter
', '&Zc % Combine back into a string with ', ' between each element
46h % Append '.' (via ASCII code) to the end of the string
1 % Push the number 1
[CEII] % Push the array: [7, 9, 3, 3]
I* % Multiply this array by 3: [21, 27, 9, 9]
llh % Append an 11 to this array: [21, 27, 9, 9, 11]
Y{ % Break our comma-separated list of characters into groups of this size
% Implicitly display the result
Jelly, 19 18 bytes
ØAp”,ṁ79334DR¤GṖ”.
Thanks to @Adnan for golfing off 1 byte!
How it works
ØAp”,ṁ79334DR¤GṖ”. Main link. No arguments.
ØA Yield "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
p”, Cartesian product with ','; append a comma to each letter.
¤ Combine the two links to the left into a niladic chain.
79334D Decimal; yield [7, 9, 3, 3, 4].
R Range; yield [[1, 2, 3, 4, 5, 6, 7], ..., [1, 2, 3, 4]].
ṁ Mold; reshape the array of letters with commata like the
generated 2D array.
G Grid; separate rows by spaces, columns by linefeeds.
Ṗ Pop; discard the last comma.
”. Print the previous result and set the return value to '.'.
(implicit) Print the return value.
PHP, 62 Bytes
<?=preg_filter("# ([HQTW])#","\n$1",join(", ",range(A,Z)));?>.
only for comparison 87 Bytes
<?="A, B, C, D, E, F, G,\nH, I, J, K, L, M, N, O, P,\nQ, R, S,\nT, U, V,\nW, X, Y, Z.";
PowerShell v3+, 60 78 67 bytes
-join(65..90|%{[char]$_+'.,'[$_-le89]+" "+"`n"*($_-in71,80,83,86)})
OK. I've actually read, understood, and followed the spec this time. Promise. :D
Takes the array 65..90 and loops over each element |%{...}. Each iteration, we're constructing a new string using concatenation, indexing, and multiplication.
First, we take the current number and char cast it to make it an ASCII letter. That's concatenated with another char, based on indexing into the string '.,' whether we're at 90 or not (i.e., to account for Z. while having all the rest be commas). That's string concatenated with " " to space-separate the letters, and string multiplication of "`n" based on Boolean value for whether the current element is -in the specified array (i.e., whether we need to concatenate on a newline character). The resulting string is left on the pipeline.
Those strings are encapsulated in parens, and -joined together into a new string, which is then also left on the pipeline and implicit Write-Output at the end prints the result. Since we have `n in the string, it's automatically converted to newlines upon printing.
Requires v3+ for the -in operator. Has a trailing space on each line, which is OK per the challenge specs.
Example
PS C:\Tools\Scripts\golfing> .\now-i-know-my-abc.ps1
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, Z.
JavaScript (ES6), 80 74 bytes
_=>[...`ABCDEFGHIJKLMNOPQRSTUVWXYZ`].join`, `.replace(/[HQTW]/g,`
$&`)+`.`
Probably possible to shorten this with atob/btoa if you can work out how to use ISO-8859-1 encoding. Edit: Saved 6 bytes thanks to @RickHitchcock.
Retina, 43 bytes
Z
{2`
$`
}T01`L`_L
.
$&,
[HQTW]
¶$&
, $
.
Leading newline is significant. Try it online!
This is my first time using Retina, so any golfing tips are appreciated...
Cheddar, 70 bytes
->[65@"71,72@"80,"QRS","TUV","WXYZ"].map(@.chars.join(", ")).vfuse+'.'
Looks like it's not getting shorter than this. I've made other versions of this which use quite interesting methods but this is shortest
Explanation
-> // Function with no arguments
[ // Array, each item represents a line
65@"71, // See below on what @" does
72@"80,
"QRS",
"TUV",
"WXYZ"
].map( // On each item...
@.chars.join(", ") // Join the characters on ", "
).vfuse // Vertical fuse or join by newlines
+ '.' // The period at the end
The @" operator is used to generate string ranged. It generates a string starting from the left char code to the right char code.
For example, 65 is the char code for A and 90 for Z. Doing 65 @" 90 would generate A through Z or the alphabet.
q, 46 bytes
-1@'(", "sv/:0 7 16 19 22_,:'[.Q.A]),'",,,,.";
05AB1E, 16 bytes
Code
A',â79334S£»¨'.J
Explanation:
A # Push the alphabet.
',â # Cartesian product with ','.
79334S # Push [7, 9, 3, 3, 4].
£ # Contigious substring, pushes the substrings [0:7], [7:7+9],
[7+9:7+9+3], [7+9+3:7+9+3+3], [7+9+3+3:7+9+3+3+4].
» # Gridify, join the inner arrays with spaces and join those arrays
with newlines.
¨ # Remove the last character.
'.J # Append a '.'-character.
Uses the CP-1252 encoding. Try it online!