Generate lower case ASCII alphabet: Difference between revisions

m
(add Zig example)
m (→‎{{header|OCaml}}: alternative)
 
(23 intermediate revisions by 20 users not shown)
Line 7:
 
During code review it's not immediate obvious to spot the bug in a Tcl line like this contained in a page of code:
<langsyntaxhighlight lang="tcl">set alpha {a b c d e f g h i j k m n o p q r s t u v w x y z}</langsyntaxhighlight>
 
 
Line 15:
=={{header|0815}}==
This creates the list in the queue
<langsyntaxhighlight lang="0815"><:61:~}:000:>>&{~<:7a:-#:001:<:1:+^:000:</langsyntaxhighlight>
 
=={{header|11l}}==
<syntaxhighlight lang ="11l">print(Array(‘a’..‘z’))</langsyntaxhighlight>
{{out}}
<pre>
Line 27:
In EBCDIC coding there are more than 24 characters between a and z.
So we have to get rid of characters between i and j and also between r and s.
<langsyntaxhighlight lang="360asm">* Generate lower case alphabet - 15/10/2015
LOWER CSECT
USING LOWER,R15 set base register
Line 54:
PG DS CL26 buffer
YREGS
END LOWER</langsyntaxhighlight>
{{out}}
<pre>
Line 62:
=={{header|6502 Assembly}}==
Stores the lower-case ASCII alphabet as a null-terminated string beginning at address 2000 hex. Register contents are preserved.
<langsyntaxhighlight lang="asm6502">ASCLOW: PHA ; push contents of registers that we
TXA ; shall be using onto the stack
PHA
Line 78:
TAX ; the stack
PLA
RTS ; return</langsyntaxhighlight>
 
=={{header|68000 Assembly}}==
Line 88:
Called as a subroutine (i.e. "JSR Ascii_Low" if far away or "BSR Ascii_Low" if nearby)
 
<langsyntaxhighlight lang="68000devpac">
Ascii_Low:
MOVEM.L D0/A0,-(SP) ;store D0 and A0 on stack
Line 105:
 
rts
</syntaxhighlight>
</lang>
 
=={{header|8080 Assembly}}==
Line 112:
in the form of an <code>$</code>-terminated string that CP/M syscalls can use.
 
<langsyntaxhighlight lang="8080asm"> org 100h
jmp test
 
Line 141:
 
buf: ds 27 ; buffer to keep the alphabet in
</syntaxhighlight>
</lang>
 
=={{header|8086 Assembly}}==
 
<langsyntaxhighlight lang="asm"> bits 16
cpu 8086
org 100h
Line 169:
ret
section .bss
buf: resb 27 ; Buffer to store the alphabet in</langsyntaxhighlight>
 
=={{header|8th}}==
We take an empty string, and use the "loop" word to create a new character using "'a n:+". The loop passes the current index to the code being iterated, so it starts with 0 and up to 25, adding to the "'a" - which is the numeric value of lowercase "a", and the resultant number is then appended to the string. That converts the number to the appropriate character and appends it:
<langsyntaxhighlight lang="forth">
"" ( 'a n:+ s:+ ) 0 25 loop
. cr
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 184:
=={{header|ABAP}}==
=== Example with simple write statement ===
<langsyntaxhighlight ABAPlang="abap">REPORT lower_case_ascii.
 
WRITE: / to_lower( sy-abcde ).</langsyntaxhighlight>
 
=== Example with / without space using CL_DEMO_OUTPUT class ===
<langsyntaxhighlight ABAPlang="abap">REPORT lower_case_ascii.
 
cl_demo_output=>new(
Line 198:
ELSE |{ out } { COND string( WHEN char <> strlen( sy-abcde ) THEN sy-abcde+char(1) ) }| ) )
)->write( |Or use the system field: { sy-abcde }|
)->display( ).</langsyntaxhighlight>
 
=={{header|Action!}}==
<langsyntaxhighlight Actionlang="action!">byte X
 
Proc Main()
Line 210:
Od
 
Return</langsyntaxhighlight>
{{Out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
Line 218:
We start with a strong type definition: A character range that can only hold lower-case letters:
 
<langsyntaxhighlight Adalang="ada"> type Lower_Case is new Character range 'a' .. 'z';</langsyntaxhighlight>
 
Now we define an array type and initialize the Array A of that type with the 26 letters:
<langsyntaxhighlight Adalang="ada"> type Arr_Type is array (Integer range <>) of Lower_Case;
A : Arr_Type (1 .. 26) := "abcdefghijklmnopqrstuvwxyz";</langsyntaxhighlight>
 
Strong typing would catch two errors: (1) any upper-case letters or other symbols in the string assigned to A, and (2) too many or too few letters assigned to A. However, a letter might still appear twice (or more) in A, at the cost of one or more other letters. Array B is safe even against such errors:
 
<langsyntaxhighlight Adalang="ada"> B : Arr_Type (1 .. 26);
begin
B(B'First) := 'a';
for I in B'First .. B'Last-1 loop
B(I+1) := Lower_Case'Succ(B(I));
end loop; -- now all the B(I) are different</langsyntaxhighlight>
 
=={{header|ALGOL 68}}==
{{works with|ALGOL 68G|Any - tested with release 2.6.win32}}
<langsyntaxhighlight lang="algol68"> # in ALGOL 68, a STRING is an array of characters with flexible bounds #
# so we can declare an array of 26 characters and assign a string #
# containing the lower-case letters to it #
 
[ 26 ]CHAR lc := "abcdefghijklmnopqrstuvwxyz"
</syntaxhighlight>
</lang>
Alternative version
<langsyntaxhighlight lang="algol68"> # fills lc with the 26 lower-case letters, assuming that #
# they are consecutive in the character set, as they are in ASCII #
 
Line 250:
DO
lc[ i ] := REPR ( ABS "a" + ( i - 1 ) )
OD</langsyntaxhighlight>
 
=={{header|ALGOL W}}==
<langsyntaxhighlight lang="algolw"> % set lc to the lower case alphabet %
string(26) lc;
for c := 0 until 25 do lc( c // 1 ) := code( decode( "a" ) + c );</langsyntaxhighlight>
 
=={{header|APL}}==
{{works with|Dyalog APL}}
<langsyntaxhighlight lang="apl"> ⎕UCS 96+⍳26</langsyntaxhighlight>
 
=={{header|AppleScript}}==
 
<langsyntaxhighlight AppleScriptlang="applescript">-------------------- ALPHABETIC SERIES -------------------
on run
unlines(map(concat, ¬
Line 354:
set my text item delimiters to dlm
s
end unlines</langsyntaxhighlight>
{{Out}}
<pre>abcdefghijklmnopqrstuvwxyz
Line 363:
A minor variation would be to perform a mass conversion and character extraction at the end instead of twenty-six individual <tt>character id i</tt> conversions:
 
<langsyntaxhighlight lang="applescript">set l to {}
repeat with i from id of "a" to id of "z"
set end of l to i
end repeat
 
return characters of string id l</langsyntaxhighlight>
{{Out}}
<langsyntaxhighlight lang="applescript">{"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"}</langsyntaxhighlight>
 
=={{header|Applesoft BASIC}}==
<langsyntaxhighlight ApplesoftBasiclang="applesoftbasic">L$="abcdefghijklmnopqrstuvwxyz"</langsyntaxhighlight>
On the older model Apple II and Apple II plus, it is difficult to enter lower case characters. The following code generates the same string:
<langsyntaxhighlight ApplesoftBasiclang="applesoftbasic">L$="":FORI=1TO26:L$=L$+CHR$(96+I):NEXT</langsyntaxhighlight>
 
=={{header|ARM Assembly}}==
Line 385:
This code generates the lower case ASCII set, stores it in RAM as a string literal, and prints that string to the screen.
 
<langsyntaxhighlight ARMlang="arm Assemblyassembly">ProgramStart:
mov sp,#0x03000000 ;Init Stack Pointer
Line 410:
 
forever:
b forever ;halt the cpu</langsyntaxhighlight>
{{out}}
[https://ibb.co/4SbsgzP Picture of output]
Line 416:
=={{header|Arturo}}==
 
<langsyntaxhighlight lang="rebol">print to [:char] 97..122</langsyntaxhighlight>
 
{{out}}
Line 422:
 
=={{header|ATS}}==
<syntaxhighlight lang="ats">
<lang ATS>
(* ****** ****** *)
//
Line 449:
//
} (* end of [main0] *)
</syntaxhighlight>
</lang>
 
=={{header|AutoHotkey}}==
{{works with|AutoHotkey 1.1}}
<langsyntaxhighlight AutoHotkeylang="autohotkey">a :={}
Loop, 26
a.Insert(Chr(A_Index + 96))</langsyntaxhighlight>
 
=={{header|AutoIt}}==
<syntaxhighlight lang="autoit">
<lang AutoIt>
Func _a2z()
Local $a2z = ""
Line 466:
Return $a2z
EndFunc
</syntaxhighlight>
</lang>
 
=={{header|AWK}}==
Line 475:
Note this is dependent on the locale-setting,
and options, e.g. --traditional and --posix
<syntaxhighlight lang="awk">
<lang AWK>
# syntax: GAWK -f GENERATE_LOWER_CASE_ASCII_ALPHABET.AWK
BEGIN {
Line 487:
exit(0)
}
</syntaxhighlight>
</lang>
{{Output}}
<pre>
Line 496:
=={{header|BASIC}}==
==={{header|BBC BASIC}}===
<langsyntaxhighlight lang="bbcbasic"> DIM lower&(25)
FOR i%=0TO25
lower&(i%)=ASC"a"+i%
NEXT
END</langsyntaxhighlight>
 
==={{header|BASIC256}}===
<langsyntaxhighlight lang="basic256">
# generate lowercase ascii alphabet
# basic256 1.1.4.0
Line 513:
print a$[i] + " ";
next i
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 520:
 
==={{header|Commodore BASIC}}===
<langsyntaxhighlight lang="gwbasic">10 FOR I=ASC("A") TO ASC("Z")
20 A$ = A$+CHR$(I)
30 NEXT
40 PRINT CHR$(14) : REM 'SWITCH CHARACTER SET TO LOWER/UPPER CASES
50 PRINT A$</langsyntaxhighlight>
 
==={{header|FreeBASIC}}===
<langsyntaxhighlight lang="freebasic">' FB 1.05.0 Win64
 
' Create a string buffer to store the alphabet plus a final null byte
Line 541:
Print "Press any key to quit"
Sleep
</syntaxhighlight>
</lang>
 
{{out}}
Line 549:
 
==={{header|IS-BASIC}}===
<langsyntaxhighlight ISlang="is-BASICbasic">100 STRING ALPHA$*26
110 LET ALPHA$=""
120 FOR I=ORD("a") TO ORD("z")
130 LET ALPHA$=ALPHA$&CHR$(I)
140 NEXT
150 PRINT ALPHA$</langsyntaxhighlight>
 
==={{header|PureBasic}}===
<langsyntaxhighlight lang="purebasic">Dim lower_case('z' - 'a') ;indexing goes from 0 -> 25
For i = 0 To ArraySize(lower_case())
lower_case(i) = i + 'a'
Next</langsyntaxhighlight>
 
==={{header|QBasic}}===
Line 566:
{{works with|QuickBasic|4.5}}
{{works with|True BASIC}}
<langsyntaxhighlight QBasiclang="qbasic">DIM a$(27)
 
FOR i = 1 to 26
Line 572:
PRINT a$(i);
NEXT i
END</langsyntaxhighlight>
 
==={{header|True BASIC}}===
{{works with|QBasic|1.1}}
{{works with|QuickBasic|4.5}}
<langsyntaxhighlight QBasiclang="qbasic">DIM a$(27)
 
FOR i = 1 to 26
Line 583:
PRINT a$(i);
NEXT i
END</langsyntaxhighlight>
 
==={{header|XBasic}}===
{{works with|Windows XBasic}}
<syntaxhighlight lang="qbasic">PROGRAM "progname"
VERSION "0.0000"
 
DECLARE FUNCTION Entry ()
 
FUNCTION Entry ()
DIM a$[27]
 
FOR i = 1 TO 26
a$[i] = CHR$(i + 96)
PRINT a$[i];
NEXT i
 
END FUNCTION
END PROGRAM</syntaxhighlight>
 
==={{header|Yabasic}}===
Line 589 ⟶ 607:
{{works with|QuickBasic|4.5}}
{{works with|Run BASIC}}
<langsyntaxhighlight lang="yabasic">for i = asc("a") to asc("z")
print chr$(i);
next i</langsyntaxhighlight>
 
==={{header|Run BASIC}}===
<langsyntaxhighlight Runbasiclang="runbasic">for i = asc("a") to asc("z")
print chr$(i);
next i</langsyntaxhighlight>Output:
<pre>abcdefghijklmnopqrstuvwxyz</pre>
 
==={{header|uBasic/4tH}}===
<syntaxhighlight lang="text">For x= ORD("a") To ORD("z") : @(x - ORD("a")) = x : Next</langsyntaxhighlight>
 
==={{header|ZX Spectrum Basic}}===
{{trans|BBC_BASIC}}
<langsyntaxhighlight lang="zxbasic">10 DIM l$(26): LET init= CODE "a"-1
20 FOR i=1 TO 26
30 LET l$(i)=CHR$ (init+i)
40 NEXT i
50 PRINT l$</langsyntaxhighlight>
 
==={{header|BaCon}}===
Using the inline loop construct.
<langsyntaxhighlight lang="bacon">PRINT LOOP$(26, CHR$(96+_))</langsyntaxhighlight>
{{out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
 
=={{header|Batch File}}==
<langsyntaxhighlight lang="dos">
@echo off
setlocal enabledelayedexpansion
Line 629 ⟶ 647:
echo %alphabet%
pause>nul
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 637 ⟶ 655:
=={{header|Befunge}}==
The left hand side pushes the sequence 'a' to 'z' onto the stack in reverse order with a null terminator (a fairly typical Befunge pattern). The right hand side is just printing it out again to test.
<langsyntaxhighlight Befungelang="befunge">0"z":>"a"`#v_ >:#,_$@
^:- 1:<</langsyntaxhighlight>
 
=={{header|BQN}}==
<syntaxhighlight lang ="bqn">'a'+↕26</langsyntaxhighlight>
 
=={{header|Bracmat}}==
<langsyntaxhighlight lang="bracmat"> a:?seq:?c
& whl
' ( chr$(asc$!c+1):~>z:?c
& !seq !c:?seq
)
& !seq</langsyntaxhighlight>
 
=={{header|Brainf***}}==
 
<langsyntaxhighlight lang="bf">Make room for 26 characters
>>>>>>>>>>>>>
>>>>>>>>>>>>>
Line 678 ⟶ 696:
Print each cell
>[.>]
++++++++++. \n</langsyntaxhighlight>
 
Uncommented:
<langsyntaxhighlight lang="bf">>>>>>>>>>>>>>>>>>>>>>>>>>>>>++++++++++++++++++++++++++[-<<[+<]
+[>]>]<<[+++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++<]>[.>]++++++++++.</langsyntaxhighlight>
 
A smaller and faster solution:
 
<langsyntaxhighlight lang="bf">++++++++++++++++++++++++++ >
++++++++++++++++++++++++++ ++++++
++++++++++++++++++++++++++ ++++++
++++++++++++++++++++++++++ ++++++
< [ - > + . < ]</langsyntaxhighlight>
 
{{out}}
Line 697 ⟶ 715:
 
=={{header|Burlesque}}==
<langsyntaxhighlight lang="burlesque">blsq ) @azr\sh
abcdefghijklmnopqrstuvwxyz</langsyntaxhighlight>
 
=={{header|C}}==
<langsyntaxhighlight lang="c">#include <stdlib.h>
 
#define N 26
Line 714 ⟶ 732:
return EXIT_SUCCESS;
}
</syntaxhighlight>
</lang>
 
=={{header|C sharp}}==
Simple Linq 1 liner solution
<langsyntaxhighlight lang="csharp">using System;
using System.Linq;
 
Line 727 ⟶ 745:
Console.WriteLine(String.Concat(Enumerable.Range('a', 26).Select(c => (char)c)));
}
}</langsyntaxhighlight>{{Output}}<pre>abcdefghijklmnopqrstuvwxyz</pre>
 
Old style Property and enumerable based solution
<langsyntaxhighlight lang="csharp">namespace RosettaCode.GenerateLowerCaseASCIIAlphabet
{
using System;
Line 753 ⟶ 771:
}
}
}</langsyntaxhighlight>{{Output}}<pre>abcdefghijklmnopqrstuvwxyz</pre>
 
=={{header|C++}}==
C++ can do the task in the identical way as C, or else, it can use a STL function.
{{works with|C++11}}
<langsyntaxhighlight lang="cpp">#include <string>
#include <numeric>
 
Line 765 ⟶ 783:
 
std::iota(lower.begin(), lower.end(), 'a');
}</langsyntaxhighlight>
 
=={{header|Clojure}}==
<langsyntaxhighlight lang="clojure">(map char (range (int \a) (inc (int \z))))</langsyntaxhighlight>
{{out}}
<pre>
Line 775 ⟶ 793:
 
=={{header|CLU}}==
<langsyntaxhighlight lang="clu">alph = proc () returns (string)
a: int := char$c2i('a')
letters: array[char] := array[char]$predict(1,26)
Line 787 ⟶ 805:
start_up = proc ()
stream$putl(stream$primary_output(), alph())
end start_up</langsyntaxhighlight>
{{out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
=={{header|COBOL}}==
Strings in COBOL are mutable and can be subscripted: each time we go round the loop, we assign to a one-character-long section of the string we are building.
<langsyntaxhighlight lang="cobol">identification division.
program-id. lower-case-alphabet-program.
data division.
Line 808 ⟶ 826:
add-next-letter-paragraph.
add 97 to loop-counter giving character-code.
move function char(character-code) to lower-case-alphabet(loop-counter:1).</langsyntaxhighlight>
{{out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
 
=={{header|CoffeeScript}}==
<langsyntaxhighlight lang="coffeescript">
(String.fromCharCode(x) for x in [97..122])
</syntaxhighlight>
</lang>
 
=={{header|Comal}}==
<langsyntaxhighlight lang="comal">dim alphabet$ of 26
for i := 1 to 26
alphabet$(i) := chr$(ord("a") - 1 + i)
endfor i
print alphabet$</langsyntaxhighlight>
{{Out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
Line 828 ⟶ 846:
=={{header|Common Lisp}}==
<nowiki>;; as a list</nowiki>
<langsyntaxhighlight lang="lisp">(defvar *lower*
(loop with a = (char-code #\a)
for i below 26
collect (code-char (+ a i))))</langsyntaxhighlight>
 
<nowiki>;; as a string</nowiki>
<langsyntaxhighlight lang="lisp">(defvar *lowercase-alphabet-string*
(map 'string #'code-char (loop
for c from (char-code #\a) to (char-code #\z)
collect c))
"The 26 lower case letters in alphabetical order.")</langsyntaxhighlight>
 
<nowiki>;; verify</nowiki>
<langsyntaxhighlight lang="lisp">(assert (= 26 (length *lowercase-alphabet-string*) (length *lower*)))
(assert (every #'char< *lowercase-alphabet-string* (subseq *lowercase-alphabet-string* 1)))
(assert (apply #'char< *lower*))
(assert (string= *lowercase-alphabet-string* (coerce *lower* 'string)))</langsyntaxhighlight>
 
=={{header|Cowgol}}==
<langsyntaxhighlight lang="cowgol">include "cowgol.coh";
 
# Generate the alphabet and store it at the given location
Line 864 ⟶ 882:
# Use the subroutine to print the alphabet
var buf: uint8[27]; # make room for the alphabet
print(alph(&buf as [uint8]));</langsyntaxhighlight>
 
{{out}}
Line 872 ⟶ 890:
=={{header|D}}==
The lower case ASCII letters of the Phobos standard library:
<langsyntaxhighlight lang="d">import std.ascii: lowercase;
 
void main() {}</langsyntaxhighlight>
 
The generation of the ASCII alphabet array:
<langsyntaxhighlight lang="d">void main() {
char['z' - 'a' + 1] arr;
 
foreach (immutable i, ref c; arr)
c = 'a' + i;
}</langsyntaxhighlight>
 
An alternative version:
<langsyntaxhighlight lang="d">void main() {
import std.range, std.algorithm, std.array;
 
char[26] arr = 26.iota.map!(i => cast(char)('a' + i)).array;
}</langsyntaxhighlight>
Another version:
<langsyntaxhighlight lang="d">void main() {
char[] arr;
 
Line 898 ⟶ 916:
 
assert(arr == "abcdefghijklmnopqrstuvwxyz");
}</langsyntaxhighlight>
 
=={{header|dc}}==
Construct the numerical representation of the desired output and print it.
<langsyntaxhighlight lang="dc">122 [ d 1 - d 97<L 256 * + ] d sL x P</langsyntaxhighlight>
Output:
<pre>
Line 909 ⟶ 927:
 
=={{header|Delphi}}==
<langsyntaxhighlight lang="delphi">program atoz;
 
var
Line 919 ⟶ 937:
write(ch);
end;
end.</langsyntaxhighlight>{{Output}}<pre>abcdefghijklmnopqrstuvwxyz</pre>
 
=={{header|Draco}}==
<langsyntaxhighlight lang="draco">/* Generate the lowercase alphabet and store it in a buffer */
proc alph(*char buf) *char:
channel output text ch;
Line 938 ⟶ 956:
[27] char buf; /* one byte extra for the string terminator */
writeln(alph(&buf[0]))
corp</langsyntaxhighlight>
{{out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
Line 946 ⟶ 964:
In DUP, strings between double quotes are stored in a numerically addressed array. The integer before the first <code>"</code> which gets pushed on the data stack, defines the cell address in which the ASCII value of first character of the string will be stored. All following characters will be stored like an array as values in the following cells. At the end, DUP pushes the length of the string on the data stack.
 
<langsyntaxhighlight DUPlang="dup">0"abcdefghijklmnopqrstuvwxyz" {store character values of string in cells 0..length of string-1}
26[$][^^-;,1-]# {Loop from 26-26 to 26-0, print the respective cell contents to STDOUT}</langsyntaxhighlight>
 
Output:
Line 957 ⟶ 975:
Generates a lazy sequence and prints it to a standard output:
 
<langsyntaxhighlight lang="dyalect">print << ('a'..'z').ToArray()</langsyntaxhighlight>
 
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
# Generated on an array
for i = 97 to 122
alphabet$[] &= strchar i
.
print alphabet$[]
# Generated on a string
for i = 97 to 122
alphabet$ &= strchar i
.
print alphabet$
</syntaxhighlight>
 
=={{header|EchoLisp}}==
<langsyntaxhighlight lang="scheme">
;; 1)
(define \a (first (string->unicode "a")))
Line 975 ⟶ 1,007:
(for/string ((letter ["a" .. "z"])) letter)
→ abcdefghijklmnopqrstuvwxyz
</syntaxhighlight>
</lang>
 
=={{header|Elena}}==
ELENA 56.0x :
<langsyntaxhighlight lang="elena">import extensions;
import system'collections;
Line 988 ⟶ 1,020:
char current;
get Value() = current;
bool next()
Line 1,020 ⟶ 1,052:
{
console.printLine(Alphabet)
}</langsyntaxhighlight>
{{out}}
<pre>
Line 1,027 ⟶ 1,059:
 
=={{header|Elixir}}==
<langsyntaxhighlight lang="elixir">iex(1)> Enum.to_list(?a .. ?z)
'abcdefghijklmnopqrstuvwxyz'
iex(2)> Enum.to_list(?a .. ?z) |> List.to_string
"abcdefghijklmnopqrstuvwxyz"</langsyntaxhighlight>
 
=={{header|Erlang}}==
<langsyntaxhighlight lang="erlang">lists:seq($a,$z).</langsyntaxhighlight>
 
{{Output}}
Line 1,046 ⟶ 1,078:
 
{{Works with|Office 365 betas 2021}}
<langsyntaxhighlight lang="lisp">showAlphabet
=LAMBDA(az,
ENUMFROMTOCHAR(
Line 1,053 ⟶ 1,085:
MID(az, 2, 1)
)
)</langsyntaxhighlight>
 
and also assuming the following generic binding in the Name Manager for the WorkBook:
 
<langsyntaxhighlight lang="lisp">ENUMFROMTOCHAR
=LAMBDA(a,
LAMBDA(z,
Line 1,078 ⟶ 1,110:
)
)
)</langsyntaxhighlight>
 
{{Out}}
Line 1,329 ⟶ 1,361:
 
=={{header|F_Sharp|F#}}==
<langsyntaxhighlight lang="fsharp">let lower = ['a'..'z']
 
printfn "%A" lower</langsyntaxhighlight>
 
=={{header|Factor}}==
Strings are represented as fixed-size mutable sequences of Unicode code points.
 
<langsyntaxhighlight lang="factor">USING: spelling ; ! ALPHABET
 
ALPHABET print
Line 1,342 ⟶ 1,374:
: russian-alphabet-without-io ( -- str ) 0x0430 0x0450 [a,b) >string ;
: russian-alphabet ( -- str ) 0x0451 6 russian-alphabet-without-io insert-nth ;
russian-alphabet print</langsyntaxhighlight>
{{out}}
<pre>abcdefghijklmnopqrstuvwxyz
Line 1,349 ⟶ 1,381:
 
=={{header|FALSE}}==
<langsyntaxhighlight FALSElang="false">'a[$'z>~][$,1+]#%</langsyntaxhighlight>
 
{{Out}}
Line 1,355 ⟶ 1,387:
 
=={{header|Fermat}}==
<langsyntaxhighlight lang="fermat">Array locase[1,26];
[locase]:=[<i=1,26>'a'+i-1];
!([locase:char);</langsyntaxhighlight>
{{out}}<pre>abcdefghijklmnopqrstuvwxyz</pre>
 
=={{header|Forth}}==
Generate a string filled with the lowercase ASCII alphabet
<langsyntaxhighlight Forthlang="forth">: printit 26 0 do [char] a I + emit loop ;</langsyntaxhighlight>
Or coded another way
<langsyntaxhighlight Forthlang="forth">: printit2 [char] z 1+ [char] a do I emit loop ;</langsyntaxhighlight>
 
We could do something more complicated and allocate space for a string and fill it.
Two methods are demonstrated below
 
<syntaxhighlight lang="forth">create lalpha 27 chars allot \ create a string in memory for 26 letters and count byte
 
: ]lalpha ( index -- addr ) \ index the string like an array (return an address)
lalpha char+ + ;
 
Line 1,387 ⟶ 1,419:
: Loadit s" abcdefghijklmnopqrstuvwxyz" lalpha PLACE ;
 
</syntaxhighlight>
</lang>
 
{{Output}}Test at the console
<syntaxhighlight lang="text">printit abcdefghijklmnopqrstuvwxyz ok
 
fillit ok
Line 1,398 ⟶ 1,430:
loadit ok
lalpha count type abcdefghijklmnopqrstuvwxyz ok
</syntaxhighlight>
</lang>
 
=={{header|Fortran}}==
{{works with|Fortran|90 and later}}
<langsyntaxhighlight lang="fortran"> character(26) :: alpha
integer :: i
 
do i = 1, 26
alpha(i:i) = achar(iachar('a') + i - 1)
end do</langsyntaxhighlight>
 
=={{header|Free Pascal}}==
One can use ''set constructors'' like in [[#Delphi|Delphi]].
<tt>alphabet</tt>’s type will be <tt>set of char</tt>.
<langsyntaxhighlight lang="pascal">program lowerCaseAscii(input, output, stdErr);
const
alphabet = ['a'..'z'];
begin
end.</langsyntaxhighlight>
Note, Pascal does not define that the letters A through Z are contiguous, the set constructor above assumes that, though.
However, the FPC – the FreePascal compiler – virtually only works on systems, that use at least ASCII as common denominator.
Line 1,422 ⟶ 1,454:
=={{header|Frink}}==
The following produces a lazy enumerating sequence of the characters.
<langsyntaxhighlight lang="frink">map["char", char["a"] to char["z"]]</langsyntaxhighlight>
To produce a non-lazy array of the characters, you can wrap the above in a <CODE>toArray</CODE> call:
<langsyntaxhighlight lang="frink">toArray[map["char", char["a"] to char["z"]]]</langsyntaxhighlight>
 
=={{header|Furor}}==
<syntaxhighlight lang="furor">
<lang Furor>
#k 'a 'z ++ {|| {} print SPACE |} NL end
</syntaxhighlight>
</lang>
{{out}}
<pre>
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
</pre>
 
=={{header|Peri}}==
<syntaxhighlight lang="peri">
###sysinclude standard.uh
#k 'a 'z ++ {{ , {{}} print SPACE }} NL end
</syntaxhighlight>
{{out}}
<pre>
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
</pre>
 
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
long i
for i = asc("a") to asc("z")
print chr$(i);
next
HandleEvents
</syntaxhighlight>
{{output}}
<pre>
abcdefghijklmnopqrstuvwxyz
</pre>
 
 
=={{header|Gambas}}==
'''[https://gambas-playground.proko.eu/?gist=debd3987d4db75099032a86927978046 Click this link to run this code]'''
<langsyntaxhighlight lang="gambas">Public Sub Main()
Dim siCount As Short
 
Line 1,444 ⟶ 1,500:
Next
 
End</langsyntaxhighlight>
Output:
<pre>
Line 1,451 ⟶ 1,507:
 
=={{header|Go}}==
<langsyntaxhighlight lang="go">func loweralpha() string {
p := make([]byte, 26)
for i := range p {
Line 1,457 ⟶ 1,513:
}
return string(p)
}</langsyntaxhighlight>
 
=={{header|Groovy}}==
<langsyntaxhighlight lang="groovy">def lower = ('a'..'z')</langsyntaxhighlight>
Test
<langsyntaxhighlight lang="groovy">assert 'abcdefghijklmnopqrstuvwxyz' == lower.join('')</langsyntaxhighlight>
 
=={{header|Haskell}}==
<langsyntaxhighlight lang="haskell">lower = ['a' .. 'z']
 
main = print lower</langsyntaxhighlight>
 
Or, equivalently:
<langsyntaxhighlight lang="haskell">alpha :: String
alpha = enumFromTo 'a' 'z'
 
main :: IO ()
main = print alpha</langsyntaxhighlight>
 
{{Out}}
<pre>"abcdefghijklmnopqrstuvwxyz"</pre>
 
=={{header|Hoon}}==
<syntaxhighlight lang="hoon">`(list cord)`(gulf 97 122)</syntaxhighlight>
{{Out}}
<pre>
> `(list cord)`(gulf 97 122)
<|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|>
</pre>
 
=={{header|Huginn}}==
<langsyntaxhighlight lang="huginn">import Algorithms as algo;
import Text as text;
 
Line 1,500 ⟶ 1,564:
)
);
}</langsyntaxhighlight>
{{Out}}
<pre>abcdefghijklmnopqrstuvwxyz
Line 1,512 ⟶ 1,576:
 
E.g.
<langsyntaxhighlight lang="unicon">every a := put([], !&lcase) # array of 1 character per element
c := create !&lcase # lazy generation of letters in sequence</langsyntaxhighlight>
 
<langsyntaxhighlight lang="icon">
procedure lower_case_letters() # entry point for function lower_case_letters
return &lcase # returning lower caser letters represented by the set &lcase
Line 1,523 ⟶ 1,587:
write(lower_case_letters()) # output of result of function lower_case_letters()
end
</syntaxhighlight>
</lang>
 
=={{header|Insitux}}==
<syntaxhighlight lang="insitux>(-> (map char-code "az")
(adj _ inc)
(.. range)
(map char-code))</syntaxhighlight>
<pre>
["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"]
</pre>
 
=={{header|J}}==
'''Solution''':<langsyntaxhighlight lang="j"> thru=: <. + i.@(+*)@-~
thru&.(a.&i.)/'az'
abcdefghijklmnopqrstuvwxyz</langsyntaxhighlight>
or<langsyntaxhighlight Jlang="j"> u:97+i.26
abcdefghijklmnopqrstuvwxyz</langsyntaxhighlight>
or<syntaxhighlight lang="j"> ([-.toupper)a.
abcdefghijklmnopqrstuvwxyz</syntaxhighlight>
and, obviously, other variations are possible.
 
=={{header|Java}}==
<syntaxhighlight lang="java">
<lang java>public class LowerAscii {
char[] lowerAlphabet() {
char[] letters = new char[26];
for (int code = 97; code < 123; code++)
letters[code - 97] = (char) code;
return letters;
}
</syntaxhighlight>
<pre>
abcdefghijklmnopqrstuvwxyz
</pre>
 
An alternate implementation
<syntaxhighlight lang="java">public class LowerAscii {
 
public static void main(String[] args) {
Line 1,542 ⟶ 1,630:
System.out.printf("lower ascii: %s, length: %s", sb, sb.length());
}
}</langsyntaxhighlight>
 
Output:
Line 1,556 ⟶ 1,644:
For Unicode characters beyond this range, in ES5 we have to enter a pair of Unicode number escapes.
 
<langsyntaxhighlight JavaScriptlang="javascript">(function (cFrom, cTo) {
 
function cRange(cFrom, cTo) {
Line 1,572 ⟶ 1,660:
return cRange(cFrom, cTo);
 
})('a', 'z');</langsyntaxhighlight>
 
Returns:
<langsyntaxhighlight JavaScriptlang="javascript">["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"]</langsyntaxhighlight>
 
===ES6===
Line 1,581 ⟶ 1,669:
In ES6, the new '''String.fromCodePoint()''' method can can return 4-byte characters (such as Emoji, for example) as well as the usual 2-byte characters.
 
<langsyntaxhighlight JavaScriptlang="javascript">(function (lstRanges) {
 
function cRange(cFrom, cTo) {
Line 1,602 ⟶ 1,690:
['a', 'z'],
['🐐', '🐟']
]);</langsyntaxhighlight>
 
Output:
 
<langsyntaxhighlight JavaScriptlang="javascript">[["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"],
["🐐", "🐑", "🐒", "🐓", "🐔", "🐕", "🐖", "🐗", "🐘", "🐙", "🐚", "🐛", "🐜", "🐝", "🐞", "🐟"]]</langsyntaxhighlight>
 
{{works with|ECMAScript|6}}
<langsyntaxhighlight JavaScriptlang="javascript">var letters = []
for (var i = 97; i <= 122; i++) {
letters.push(String.fromCodePoint(i))
}</langsyntaxhighlight>
 
Or, if we want to write a more general ES6 function:
 
<langsyntaxhighlight JavaScriptlang="javascript">(() => {
// enumFromTo :: Enum a => a -> a -> [a]
const enumFromTo = (m, n) => {
Line 1,671 ⟶ 1,759:
['🐐', '🐟']
]));
})();</langsyntaxhighlight>
{{Out}}
<pre>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
Line 1,677 ⟶ 1,765:
א ב ג ד ה ו ז ח ט י ך כ ל ם מ ן נ ס ע ף פ ץ צ ק ר ש ת
🐐 🐑 🐒 🐓 🐔 🐕 🐖 🐗 🐘 🐙 🐚 🐛 🐜 🐝 🐞 🐟</pre>
 
=={{header|Joy}}==
<syntaxhighlight lang="joy">'a ['z =] ["" cons] [dup succ] [cons] linrec.</syntaxhighlight>
 
=={{header|jq}}==
<langsyntaxhighlight lang="jq">"az" | explode | [range( .[0]; 1+.[1] )] | implode'</langsyntaxhighlight>
produces:
 
Line 1,685 ⟶ 1,776:
 
=={{header|Jsish}}==
<langsyntaxhighlight lang="javascript">/* Generate the lower case alphabet with Jsish, assume ASCII */
var letterA = "a".charCodeAt(0);
var lowers = Array(26);
Line 1,701 ⟶ 1,792:
26
=!EXPECTEND!=
*/</langsyntaxhighlight>
 
{{out}}
Line 1,714 ⟶ 1,805:
{{works with|Julia|0.6}}
 
<langsyntaxhighlight lang="julia">@show collect('a':'z')
@show join('a':'z')</langsyntaxhighlight>
 
{{out}}
Line 1,723 ⟶ 1,814:
=={{header|K}}==
<tt>`c$</tt> casts a list of integers to a string of characters; <tt>!26</tt> produces a list of the integers from 0 to 25. So the lower-case ASCII alphabet can be generated using:
<syntaxhighlight lang ="k">`c$97+!26</langsyntaxhighlight>
{{out}}
<pre>"abcdefghijklmnopqrstuvwxyz"</pre>
 
=={{header|Keg}}==
<syntaxhighlight lang ="keg">a(55*|:1+)</langsyntaxhighlight>
 
=={{header|Kotlin}}==
<langsyntaxhighlight lang="scala">// version 1.3.72
 
fun main() {
Line 1,737 ⟶ 1,828:
 
println(alphabet)
}</langsyntaxhighlight>
 
{{out}}
Line 1,745 ⟶ 1,836:
 
=={{header|Lambdatalk}}==
<langsyntaxhighlight lang="scheme">
 
1) We define code2char & char2code as primitives:
Line 1,768 ⟶ 1,859:
{S.map code2char {S.serie {char2code 0} {char2code 9}}}
-> 0 1 2 3 4 5 6 7 8 9
</syntaxhighlight>
</lang>
 
=={{header|Lang}}==
<syntaxhighlight lang="lang">
&alphabet = fn.arrayGenerateFrom(fn.combBX(fn.char, fn.add, a), 26)
fn.println(&alphabet)
 
# As string (Strings are called text in Lang)
$alphabetText = fn.join(\e, &alphabet)
fn.println($alphabetText)
</syntaxhighlight>
 
{{out}}
<pre>
[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]
abcdefghijklmnopqrstuvwxyz
</pre>
 
=={{header|LC3 Assembly}}==
<langsyntaxhighlight lang="lc3asm"> .ORIG 0x3000
 
LD R0,ASCIIa
Line 1,785 ⟶ 1,892:
 
ASCIIa .FILL 0x61
ASCIIz .FILL 0x7A</langsyntaxhighlight>
Output:
<pre>abcdefghijklmnopqrstuvwxyz</pre>
 
=={{header|Lingo}}==
<langsyntaxhighlight lang="lingo">alphabet = []
repeat with i = 97 to 122
alphabet.add(numtochar(i))
end repeat
put alphabet
-- ["a", "b", "c", ... , "x", "y", "z"]</langsyntaxhighlight>
 
=={{header|Logo}}==
Straightforward, assuming ASCII:
<langsyntaxhighlight lang="logo">show map "char iseq 97 122</langsyntaxhighlight>
Slightly less straightforward, but without the magic numbers:
<langsyntaxhighlight lang="logo">show map "char apply "iseq map "ascii [a z]</langsyntaxhighlight>
Same output either way:
{{Out}}
Line 1,808 ⟶ 1,915:
=={{header|Lua}}==
===to table===
<langsyntaxhighlight Lualang="lua">function getAlphabet ()
local letters = {}
for ascii = 97, 122 do table.insert(letters, string.char(ascii)) end
Line 1,815 ⟶ 1,922:
 
local alpha = getAlphabet()
print(alpha[25] .. alpha[1] .. alpha[25]) </langsyntaxhighlight>
{{Out}}
<pre>yay</pre>
 
===to string===
<langsyntaxhighlight Lualang="lua">#!/usr/bin/env luajit
local function ascii(f,t) local tab={} for i=f,t do tab[#tab+1]=string.char(i) end
return table.concat(tab)
end
print(ascii(97,122))</langsyntaxhighlight>
{{Out}}
<pre>> ./lowercaseascii.lua
Line 1,830 ⟶ 1,937:
 
=={{header|M2000 Interpreter}}==
<syntaxhighlight lang="m2000 interpreter">
<lang M2000 Interpreter>
\\ old style Basic, including a Binary.Or() function
Module OldStyle {
Line 1,840 ⟶ 1,947:
}
CALL OldStyle
</syntaxhighlight>
</lang>
 
=={{header|Maple}}==
<langsyntaxhighlight Maplelang="maple">seq(StringTools:-Char(c), c = 97 .. 122);</langsyntaxhighlight>
{{Out}}
<pre>"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"</pre>
Line 1,860 ⟶ 1,967:
'''Method 1''': Using a Range Variable.
 
<syntaxhighlight lang="mathcad">
<lang Mathcad>
-- user-defined function that returns the ASCII code for string character ch.
code(ch):=str2vec(ch)[0
Line 1,881 ⟶ 1,988:
 
-- Characters are indexable within the string; for example: substr(lcString,3,1)="d"
</langsyntaxhighlight>
 
'''Method 2''': Using a Function.
 
<syntaxhighlight lang="mathcad">
<lang Mathcad>
-- Mathcad Express lacks the programming capability of Mathcad Prime, so uses the built-in if function to implement a recursive solution (if(predicate,true expr, false expr)).
 
Line 1,900 ⟶ 2,007:
charseq(code("α"),code("ω"))="αβγδεζηθικλμνξοπρςστυφχψω"
 
</syntaxhighlight>
</lang>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<langsyntaxhighlight Mathematicalang="mathematica">start = 97;
lowerCaseLetters = Table[FromCharacterCode[start + i], {i, 0, 25}]</langsyntaxhighlight>
{{Out}}
<pre>{"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"}</pre>
 
=={{header|MATLAB}} / {{header|Octave}}==
<syntaxhighlight lang MATLAB="matlab"> 'a':'z'</langsyntaxhighlight>
or alternatively
<langsyntaxhighlight MATLABlang="matlab"> char(96+[1:26])</langsyntaxhighlight>
{{Out}}<pre> abcdefghijklmnopqrstuvwxyz</pre>
 
=={{header|Maxima}}==
<syntaxhighlight lang="maxima">
<lang Maxima>
delete([], makelist(if(alphacharp(ascii(i))) then parse_string(ascii(i)) else [], i, 96, 122));</langsyntaxhighlight>
{{Out}}
<pre> [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] </pre>
 
=={{header|Mercury}}==
<langsyntaxhighlight lang="mercury">:- module gen_lowercase_ascii.
:- interface.
 
Line 1,936 ⟶ 2,043:
io.print_line(Alphabet, !IO).
 
:- end_module gen_lowercase_ascii.</langsyntaxhighlight>
{{out}}
<pre>
Line 1,943 ⟶ 2,050:
 
=={{header|MiniScript}}==
<langsyntaxhighlight MiniScriptlang="miniscript">letters = []
for i in range(code("a"), code("z"))
letters.push char(i)
end for
 
print letters</langsyntaxhighlight>
 
{{out}}
<pre>["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"]</pre>
 
=={{header|MIPS Assembly}}==
<syntaxhighlight lang="mips">main:
li $t0,'a'
li $t1,26
loop:
jal PrintChar ;prints the low 8 bits of $t0 as an ascii character (unimplemented routine)
nop ;branch delay slot
subiu $t1,1
bne $t1,loop
addiu $t0,1
 
end_program:
j end_program ;halt the cpu - we're done
nop</syntaxhighlight>
 
=={{header|MUMPS}}==
===Caché===
{{works with|Caché ObjectScript}}
<syntaxhighlight lang="mumps">
<lang MUMPS>
LOWASCMIN
set lowstr = ""
Line 1,962 ⟶ 2,084:
write lowstr
quit
</syntaxhighlight>
</lang>
 
{{out}}<pre>
Line 1,971 ⟶ 2,093:
===Standard MUMPS===
{{works with|DSM, MSM}}
<syntaxhighlight lang="mumps">
<lang MUMPS>
LONG SET D=""
FOR X=97:1:122 WRITE D,$C(X) SET D=","
Line 1,981 ⟶ 2,103:
W !
Q
</syntaxhighlight>
</lang>
 
{{out}}<pre>
Line 1,991 ⟶ 2,113:
 
=={{header|Nanoquery}}==
<langsyntaxhighlight lang="nanoquery">lowercase = list()
for i in range(ord("a"), ord("z"))
lowercase.append(chr(i))
end
println lowercase</langsyntaxhighlight>
{{out}}
<pre>[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]</pre>
 
=={{header|Neko}}==
<syntaxhighlight lang="actionscript">/**
<lang ActionScript>/**
<doc>Generate lower case ASCII, in Neko</doc>
**/
Line 2,014 ⟶ 2,136:
}
 
$print(generated, "\n")</langsyntaxhighlight>
 
{{out}}
Line 2,022 ⟶ 2,144:
 
=={{header|NESL}}==
<langsyntaxhighlight lang="nesl">lower_case_ascii = {code_char(c) : c in [97:123]};</langsyntaxhighlight>
=={{header|NetLogo}}==
====Rationale====
Since NetLogo has no "ASC" type reporters, we will have to enumerate the characters.
To make an omission easier to detect, we use a phrase, instead of a list
Since the phrase has duplicates and spaces, we use other list tools to produce just the sorted alphabet
====Code====
<syntaxhighlight lang="netlogo">
to-report alphabet-lower
let sample "sphinx of black quartz judge my vow"
let alphabet sort remove-duplicates remove " " n-values length sample [ c -> item c sample ]
if length alphabet != 26 [ user-message "ERROR: invalid sample for alphabet function" ]
report alphabet
end
</syntaxhighlight>
====Output====
<pre>
observer> print alphabet-lower
[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]
observer> write alphabet-lower
["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"]
</pre>
 
=={{header|Nim}}==
<langsyntaxhighlight lang="nim"># A slice just contains the first and last value
let alpha: Slice[char] = 'a'..'z'
echo alpha # (a: a, b: z)
Line 2,044 ⟶ 2,187:
let alphaSeq = toSeq 'a'..'z'
echo alphaSeq # @[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]
echo alphaSeq[10] # k</langsyntaxhighlight>
 
=={{header|OCaml}}==
<langsyntaxhighlight lang="ocaml"># Array.make 26 'a' |> Array.mapi (fun i c -> int_of_char c + i |> char_of_int);;
- : char array =
[|'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'|]</langsyntaxhighlight>
 
Alternative version:
<syntaxhighlight lang="ocaml">Array.init 26 (fun x -> char_of_int (x + int_of_char 'a'))</syntaxhighlight>
 
=={{header|Oforth}}==
Oforth characters are integers. This list is a list of 26 integers
<syntaxhighlight lang Oforth="oforth">'a' 'z' seqFrom</langsyntaxhighlight>
 
If necessary, these integers can be added to a string to have a indexed string of chars
<langsyntaxhighlight Oforthlang="oforth">StringBuffer new 'a' 'z' seqFrom apply(#<<c)</langsyntaxhighlight>
 
=={{header|PARI/GP}}==
 
<langsyntaxhighlight lang="parigp">Strchr(Vecsmall([97..122]))</langsyntaxhighlight>
 
Output:<pre>"abcdefghijklmnopqrstuvwxyz"</pre>
 
=={{header|Pascal}}==
<langsyntaxhighlight lang="pascal">program lowerCaseAscii(input, output, stdErr);
var
alphabet: set of char;
Line 2,075 ⟶ 2,221:
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
];
end.</langsyntaxhighlight>
 
=={{header|Perl}}==
<syntaxhighlight lang Perl="perl">print 'a'..'z'</langsyntaxhighlight>
 
=={{header|Phix}}==
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">az</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">""</span>
<span style="color: #008080;">for</span> <span style="color: #000000;">ch</span><span style="color: #0000FF;">=</span><span style="color: #008000;">'a'</span> <span style="color: #008080;">to</span> <span style="color: #008000;">'z'</span> <span style="color: #008080;">do</span>
<span style="color: #000000;">az</span> <span style="color: #0000FF;">&=</span> <span style="color: #000000;">ch</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
<span style="color: #0000FF;">?</span><span style="color: #000000;">az</span>
<span style="color: #0000FF;">?</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #008000;">'z'</span><span style="color: #0000FF;">,</span><span style="color: #008000;">'a'</span><span style="color: #0000FF;">)</span>
<span style="color: #0000FF;">?</span><span style="color: #7060A8;">tagstart</span><span style="color: #0000FF;">(</span><span style="color: #008000;">'a'</span><span style="color: #0000FF;">,</span><span style="color: #000000;">26</span><span style="color: #0000FF;">)</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
Using tagset() is obviously easier, but you have to remember its parameters are (finish,start=1,step=1), that way round so that start ''can'' be omitted and default to 1 (ditto step).<br>
Using tagset() is obviously easier, but you have to remember its parameters are (finish,start=1,step=1), that way round so that start ''can'' be omitted and default to 1 (ditto step). tagstart() wants a length, though you could use 'z'-'a'+1 in place of the 26.<br>
In Phix there is really not much difference between 1..26 and 'a'..'z', and none ''at all'' between 'a'..'z' and 97..122.
{{out}}
<pre>
"abcdefghijklmnopqrstuvwxyz"
"abcdefghijklmnopqrstuvwxyz"
"abcdefghijklmnopqrstuvwxyz"
Line 2,098 ⟶ 2,247:
 
=={{header|Phixmonti}}==
<langsyntaxhighlight Phixmontilang="phixmonti">0 tolist
'a' 'z' 2 tolist
for
tochar 0 put
endfor
print</langsyntaxhighlight>
Simplest
<langsyntaxhighlight Phixmontilang="phixmonti">include ..\Utilitys.pmt
( 'a' 'z' ) for tochar print endfor</langsyntaxhighlight>
 
=={{header|PHP}}==
<langsyntaxhighlight lang="php"><?php
$lower = range('a', 'z');
var_dump($lower);
?></langsyntaxhighlight>
 
=={{header|Picat}}==
<langsyntaxhighlight Picatlang="picat">main =>
Alpha1 = (0'a..0'z).map(chr),
println(Alpha1),
Alpha2 = [chr(I) : I in 97..122],
println(Alpha2).</langsyntaxhighlight>
 
{{out}}
Line 2,127 ⟶ 2,276:
 
=={{header|PicoLisp}}==
<syntaxhighlight lang="text">(mapcar char (range (char "a") (char "z")))</langsyntaxhighlight>
 
=={{header|PL/I}}==
<langsyntaxhighlight PLlang="pl/Ii">gen: procedure options (main); /* 7 April 2014. */
declare 1 ascii union,
2 letters (26) character (1),
Line 2,144 ⟶ 2,293:
put edit (letters) (a);
 
end gen;</langsyntaxhighlight>
Output:
<pre>
Line 2,150 ⟶ 2,299:
</pre>
Alternative, using library:
<syntaxhighlight lang="text"> /* Accessing library lower-case ASCII (PC only). */
 
letter = lowercase('A');
i = index(collate(), letter);
put skip list (substr(collate, i, 26));</langsyntaxhighlight>
Output:
<pre>
Line 2,162 ⟶ 2,311:
 
=={{header|PL/M}}==
<langsyntaxhighlight lang="pli">100H: /* PRINT THE LOWERCASE LETTERS */
 
/* CP/M BDOS SYSTEM CALL */
Line 2,177 ⟶ 2,326:
CALL PR$STRING( .LC );
 
EOF</langsyntaxhighlight>
{{out}}
<pre>
Line 2,184 ⟶ 2,333:
 
=={{header|PL/SQL}}==
<langsyntaxhighlight PLlang="pl/SQLsql">Declare
sbAlphabet varchar2(100);
Begin
Line 2,195 ⟶ 2,344:
End loop;
Dbms_Output.Put_Line(sbAlphabet);
End;</langsyntaxhighlight>
Output:
<pre>
Line 2,206 ⟶ 2,355:
 
=={{header|Plain English}}==
<langsyntaxhighlight lang="plainenglish">To run:
Start up.
Generate the lowercase ASCII alphabet giving a string.
Line 2,219 ⟶ 2,368:
If the letter is the little-z byte, exit.
Add 1 to the letter.
Repeat.</langsyntaxhighlight>
{{out}}
<pre>
Line 2,226 ⟶ 2,375:
 
=={{header|PowerShell}}==
<syntaxhighlight lang="powershell">
<lang PowerShell>
$asString = 97..122 | ForEach-Object -Begin {$asArray = @()} -Process {$asArray += [char]$_} -End {$asArray -join('')}
$asString
</syntaxhighlight>
</lang>
{{Out}}
<pre>
abcdefghijklmnopqrstuvwxyz
</pre>
<syntaxhighlight lang="powershell">
<lang PowerShell>
$asArray
</syntaxhighlight>
</lang>
{{Out}}
<pre>
Line 2,268 ⟶ 2,417:
 
'''Alternative:'''
<syntaxhighlight lang="powershell">
<lang PowerShell>
-join [Char[]] (97..122)
</syntaxhighlight>
</lang>
{{Out}}
<pre>
Line 2,277 ⟶ 2,426:
 
'''Alternative as of PowerShell-v6.0.0rc:'''
<syntaxhighlight lang="powershell">
<lang PowerShell>
-join ('a'..'z')
</syntaxhighlight>
</lang>
{{Out}}
<pre>
Line 2,287 ⟶ 2,436:
=={{header|Prolog}}==
Works with SWI-Prolog 6.5.3
<langsyntaxhighlight Prologlang="prolog">a_to_z(From, To, L) :-
maplist(atom_codes, [From, To], [[C_From], [C_To]]),
bagof([C], between(C_From, C_To, C), L1),
maplist(atom_codes,L, L1).
</syntaxhighlight>
</lang>
Output :
<pre> ?- a_to_z(a, z, L).
Line 2,298 ⟶ 2,447:
 
=={{header|Python}}==
<langsyntaxhighlight Pythonlang="python"># From the standard library:
from string import ascii_lowercase
 
# Generation:
lower = [chr(i) for i in range(ord('a'), ord('z') + 1)]</langsyntaxhighlight>
 
Or, as a particular instance of a more general enumeration pattern:
{{Works with|Python|3.7}}
<langsyntaxhighlight lang="python">'''Enumeration a-z'''
 
from inspect import signature
Line 2,406 ⟶ 2,555:
# MAIN ---
if __name__ == '__main__':
main()</langsyntaxhighlight>
{{Out}}
<pre>Enumeration a-z:
Line 2,421 ⟶ 2,570:
The word ''constant'' causes the preceding nest to be evaluated during compilation so ''alpha$'' is a literal, not an expression computed during program evaluation.
 
<langsyntaxhighlight Quackerylang="quackery">[ [] 26 times [ i^ char a + join ] ] constant is alpha$ ( --> $ )
 
alpha$ echo$</langsyntaxhighlight>
 
{{Out}}
Line 2,430 ⟶ 2,579:
 
=={{header|R}}==
<langsyntaxhighlight Rlang="r"># From constants built into R:
letters
 
# Or generate the same with:
sapply(97:122, intToUtf8)</langsyntaxhighlight>
 
=={{header|Racket}}==
<langsyntaxhighlight lang="racket">(define lowercase-letters (build-list 26 (lambda (x) (integer->char (+ x (char->integer #\a))))))</langsyntaxhighlight>
 
=={{header|Raku}}==
Line 2,444 ⟶ 2,593:
{{works with|rakudo|2015-10-21}}
 
<syntaxhighlight lang="raku" perl6line>say my @letters = 'a'..'z';</langsyntaxhighlight>
 
* <code>'a'..'z'</code> is a range literal, it constructs an immutable <code>Range</code> object.
Line 2,452 ⟶ 2,601:
===ASCII version===
This version only works under ASCII machines &nbsp; (where the values of the lowercase '''a''' through the lowercase '''z''' characters are contiguous (and consecutive).
<langsyntaxhighlight lang="rexx">/* REXX ---------------------------------------------------------------
* 08.02.2014 Walter Pachl
*--------------------------------------------------------------------*/
say xrange('a','z')</langsyntaxhighlight>
'''Output:'''
<pre>abcdefghijklmnopqrstuvwxyz</pre>
Line 2,469 ⟶ 2,618:
Note that on an '''EBCDIC''' system, &nbsp; there are &nbsp; '''41''' &nbsp; characters between (lowercase) &nbsp; <big><big> a </big></big> &nbsp; ──► &nbsp; <big><big> z </big></big> &nbsp; &nbsp;
<br>(inclusive), &nbsp; some of which don't have viewable/displayable glyphs.
<langsyntaxhighlight lang="rexx">/*REXX program creates an indexable string of lowercase ASCII or EBCDIC characters: a─►z*/
$= /*set lowercase letters list to null. */
do j=0 for 2**8; _=d2c(j) /*convert decimal J to a character. */
if datatype(_, 'L') then $=$ || _ /*Is lowercase? Then add it to $ list.*/
end /*j*/ /* [↑] add lowercase letters ──► $ */
say $ /*stick a fork in it, we're all done. */</langsyntaxhighlight>
'''output'''
<pre>
Line 2,481 ⟶ 2,630:
 
=={{header|Ring}}==
<langsyntaxhighlight lang="ring">for i in 'a':'z'
put i
next</langsyntaxhighlight>
 
=={{header|RPL}}==
≪ ""
"a" NUM "z" NUM '''FOR''' ascii
ascii CHR + '''NEXT'''
≫ EVAL
{{out}}
<pre>
1: "abcdefghijklmnopqrstuvwxyz"
</pre>
 
=={{header|Ruby}}==
<langsyntaxhighlight lang="ruby">p ('a' .. 'z').to_a
p [*'a' .. 'z']</langsyntaxhighlight>
 
=={{header|Rust}}==
<langsyntaxhighlight lang="rust">fn main() {
// An iterator over the lowercase alpha's
let ascii_iter = (0..26)
Line 2,496 ⟶ 2,655:
println!("{:?}", ascii_iter.collect::<Vec<char>>());
}</langsyntaxhighlight>
{{out}}
<pre>
Line 2,504 ⟶ 2,663:
=={{header|S-lang}}==
Char_Type is just an integer-type so a "range array" can be easily created:
<langsyntaxhighlight Slang="s-lang">variable alpha_ch = ['a':'z'], a;</langsyntaxhighlight>
If you need single-char strings, convert thusly:
<langsyntaxhighlight Slang="s-lang">variable alpha_st = array_map(String_Type, &char, alpha_ch);</langsyntaxhighlight>
Let's take a peek:
<langsyntaxhighlight Slang="s-lang">print(alpha_st[23]);
foreach a (alpha_ch)
() = printf("%c ", a);
</syntaxhighlight>
</lang>
{{out}}
<pre>"x"
Line 2,518 ⟶ 2,677:
=={{header|Scala}}==
{{libheader|Scala}}
<langsyntaxhighlight lang="scala">object Abc extends App {
val lowAlpha = 'a' to 'z' //That's all
// Now several tests
Line 2,535 ⟶ 2,694:
scala.compat.Platform.currentTime - executionStart
} ms]")
}</langsyntaxhighlight>{{out}}
Successfully completed without errors. [within 675 ms]
Line 2,542 ⟶ 2,701:
=={{header|Scheme}}==
{{works with|Gauche Scheme}}
<langsyntaxhighlight Schemelang="scheme">(map integer->char (iota 26 (char->integer #\a)))</langsyntaxhighlight>
{{output}}
<pre>
Line 2,550 ⟶ 2,709:
 
=={{header|Seed7}}==
<langsyntaxhighlight lang="seed7">$ include "seed7_05.s7i";
 
const proc: main is func
Line 2,561 ⟶ 2,720:
end for;
writeln(lower);
end func;</langsyntaxhighlight>
 
{{out}}
Line 2,569 ⟶ 2,728:
 
=={{header|Sidef}}==
<langsyntaxhighlight lang="ruby">var arr = 'a'..'z';
say arr.join(' ');</langsyntaxhighlight>
 
=={{header|Smalltalk}}==
<langsyntaxhighlight lang="smalltalk">| asciiLower |
asciiLower := String new.
97 to: 122 do: [:asciiCode |
asciiLower := asciiLower , asciiCode asCharacter
].
^asciiLower</langsyntaxhighlight>
 
=={{header|Snobol}}==
<langsyntaxhighlight lang="sml"> &ALPHABET ('a' LEN(25)) . OUTPUT ;* Works in ASCII but not EBCDIC.</langsyntaxhighlight>
 
=={{header|SPL}}==
<langsyntaxhighlight lang="spl">> i, 1..26
d = [i+96,0]
a[i] = #.str(d)
Line 2,592 ⟶ 2,751:
> i, 1..#.size(a,1)
#.output(a[i],#.rs)
<</langsyntaxhighlight>
{{out}}
<pre>
Line 2,599 ⟶ 2,758:
 
=={{header|Standard ML}}==
<langsyntaxhighlight lang="sml">val lowercase_letters = List.tabulate (26, fn x => chr (x + ord #"a"));</langsyntaxhighlight>
 
=={{header|Stata}}==
<langsyntaxhighlight lang="stata">// built-in: lowercase and uppercase letters
display c(alpha)
display c(ALPHA)
Line 2,614 ⟶ 2,773:
mata
char(97..122)
end</langsyntaxhighlight>
 
=={{header|SuperCollider}}==
Previously, it was claimed that the method that maps ascii number to character is polymorphic on collections. However, that doesn't seem to be the case – at least not anymore in the newer version (3.10.2). A fix was added below the original code.
<syntaxhighlight lang="supercollider">
<lang SuperCollider>
(97..122).asAscii; // This example unfortunately throws an error
// for me when running it on version 3.10.2
Line 2,638 ⟶ 2,797:
 
 
</syntaxhighlight>
</lang>
Backwards:
<syntaxhighlight lang="supercollider">
<lang SuperCollider>
"abcdefghijklmnopqrstuvwxyz".ascii
// answers [ 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 ]
</syntaxhighlight>
</lang>
 
=={{header|Swift}}==
<langsyntaxhighlight Swiftlang="swift">var letters = [Character]()
 
for i in 97...122 {
let char = Character(UnicodeScalar(i))
letters.append(char)
}</langsyntaxhighlight>
 
=={{header|Tcl}}==
The most common way of doing this in Tcl would be to use a simple literal; it's only 51 characters after all:
<langsyntaxhighlight lang="tcl">set alpha {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}</langsyntaxhighlight>
Though it could be done like this as well:
<langsyntaxhighlight lang="tcl">set alpha [apply {{} {
scan "az" "%c%c" from to
for {set i $from} {$i <= $to} {incr i} {
Line 2,663 ⟶ 2,822:
}
return $l
}}]</langsyntaxhighlight>
 
=={{header|UNIX Shell}}==
In bash or ksh93 with <tt>braceexpand</tt> set:
<langsyntaxhighlight lang="sh">lower=({a..z})</langsyntaxhighlight>
 
In zsh with <tt>braceccl</tt> set:
<langsyntaxhighlight lang="sh">lower=({a-z})</langsyntaxhighlight>
 
Either way, you can display the result like this:
 
<langsyntaxhighlight lang="sh">echo "${lower[@]}"</langsyntaxhighlight>
 
{{Out}}<pre>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</pre>
Line 2,680 ⟶ 2,839:
=={{header|Ursa}}==
Creates a string named low containing the lower case ASCII alphabet.
<langsyntaxhighlight lang="ursa">decl int i
decl string low
for (set i (ord "a")) (< i (+ (ord "z") 1)) (inc i)
set low (+ low (chr i))
end for
out low endl console</langsyntaxhighlight>
 
=={{header|VBA}}==
Line 2,692 ⟶ 2,851:
{{works with|Visual Basic|6}}
 
<syntaxhighlight lang="vb">
<lang vb>
Option Explicit
 
Line 2,712 ⟶ 2,871:
Erase strarrTemp
End Function
</syntaxhighlight>
</lang>
{{out}}
<pre>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</pre>
 
=={{header|VBScript}}==
<langsyntaxhighlight lang="vb">Function ASCII_Sequence(range)
arr = Split(range,"..")
For i = Asc(arr(0)) To Asc(arr(1))
Line 2,725 ⟶ 2,884:
 
WScript.StdOut.Write ASCII_Sequence(WScript.Arguments(0))
WScript.StdOut.WriteLine</langsyntaxhighlight>
{{out}}
<pre>C:\>cscript /nologo ascii_sequence.vbs a..z
Line 2,734 ⟶ 2,893:
 
=={{header|Verilog}}==
<langsyntaxhighlight Veriloglang="verilog">module main;
integer i;
Line 2,745 ⟶ 2,904:
end
endmodule
</syntaxhighlight>
</lang>
{{out}}
<pre>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 </pre>
Line 2,751 ⟶ 2,910:
 
=={{header|Vim Script}}==
<langsyntaxhighlight lang="vim">let lower = []
for c in range(0, 25)
let lower += [nr2char(c + char2nr("a"))]
endfor</langsyntaxhighlight>
 
or:
<langsyntaxhighlight lang="vim">echo map(range(char2nr('a'), char2nr('z')), 'nr2char(v:val)')</langsyntaxhighlight>
 
=={{header|Visual Basic}}==
Line 2,769 ⟶ 2,928:
String.Join() is used to print the list, converted to array, without looping through it.
 
<langsyntaxhighlight lang="vbnet">Module LowerASCII
 
Sub Main()
Line 2,780 ⟶ 2,939:
 
End Module
</syntaxhighlight>
</lang>
 
{{out}}
Line 2,787 ⟶ 2,946:
</pre>
 
=={{header|V (Vlang)}}==
<syntaxhighlight lang="v (vlang)">fn loweralpha() string {
mut p := []u8{len: 26}
for i in 97..123 {
Line 2,794 ⟶ 2,953:
}
return p.bytestr()
}</langsyntaxhighlight>
 
=={{header|WebAssembly}}==
<langsyntaxhighlight WebAssemblylang="webassembly">(module $lowercase
 
(import "wasi_unstable" "fd_write"
Line 2,833 ⟶ 2,992:
drop
)
)</langsyntaxhighlight>
 
{{out}}
Line 2,842 ⟶ 3,001:
 
=={{header|Wren}}==
<langsyntaxhighlight javascriptlang="wren">var alpha = []
for (c in 97..122) alpha.add(String.fromByte(c))
System.print(alpha.join())</langsyntaxhighlight>
 
{{out}}
Line 2,852 ⟶ 3,011:
 
=={{header|xEec}}==
<langsyntaxhighlight xEeclang="xeec">h$` h$` >0_0 t h$y ms p h? jn00_0 p r h#1 ma t jn0_0 >00_0 p p r p</langsyntaxhighlight>
 
=={{header|XLISP}}==
<langsyntaxhighlight lang="lisp">(defun ascii-lower ()
(defun add-chars (x y s)
(if (<= x y)
(add-chars (+ x 1) y (string-append s (string (integer->char x))))
s))
(add-chars 97 122 ""))</langsyntaxhighlight>
 
=={{header|XPL0}}==
<langsyntaxhighlight XPL0lang="xpl0">char I, A(26);
for I:= 0 to 26-1 do A(I):= I+^a</langsyntaxhighlight>
 
=={{header|Z80 Assembly}}==
<langsyntaxhighlight lang="z80"> org &8000
ld a,'a' ;data
ld b,26 ;loop counter
Line 2,884 ⟶ 3,043:
 
Alphabet:
ds 26,0 ;reserve 26 bytes of ram, init all to zero.</langsyntaxhighlight>
 
{{out}}
Line 2,897 ⟶ 3,056:
 
=={{header|zkl}}==
<langsyntaxhighlight lang="zkl">["a".."z"] // lasy list
["a".."z"].walk() //-->L("a","b","c","d","e",...
"a".toAsc().pump(26,List,"toChar") // another way to create the list
"a".toAsc().pump(26,String,"toChar") // create a string
//-->"abcdefghijklmnopqrstuvwxyz"
Utils.Helpers.lowerLetters // string const</langsyntaxhighlight>
 
=={{header|Zig}}==
<langsyntaxhighlight lang="zig">const std = @import("std");
 
pub fn main() !void {
Line 2,918 ⟶ 3,077:
try stdout_wr.print("{c} ", .{l});
try stdout_wr.writeByte('\n');
}</langsyntaxhighlight>
23

edits