ASCII control characters: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
(Created Nim solution.)
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(3 intermediate revisions by 3 users not shown)
Line 362:
(CNTRL.nul, CNTRL.ht, CNTRL.us, CNTRL.del) = (0, 9, 31, 127)
</pre>
 
=={{header|Maxima}}==
Those character can be put in a list and can be found their ASCII numbers.
<syntaxhighlight lang="maxima">
/* List of characters that are not constituents (constituent is a graphic character but not a space character) */
block(makelist(ascii(i),i,0,127),sublist(%%,lambda([x],not constituent(x))));
/* [,"�","�","�","�","�","�","�","�","�","
","�","�","
","�","�","�","�","�","�","�","�","�","�","�","�","�","�","�","�","�","�"," ","�"] */
 
/* Ascii numbers of characters that are not constituents */
map(cint,%);
/* [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,26,27,28,29,30,31,32,127] */
</syntaxhighlight>
 
=={{header|Nim}}==
Line 454 ⟶ 468:
Ord: 31, Unicode: <control-001F>, Enum: ␟
Ord: 127, Unicode: <control-007F>, Enum: ␡
</pre>
 
=={{header|RPL}}==
There is no enum in RPL, but we can create global variables, each containing a specific control character, which are then available to all programs in the same directory tree.
≪ { NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US }
0 31 '''FOR''' ctrl
ctrl CHR OVER ctrl GET STO
'''NEXT''' DROP
127 CHR 'DEL' STO
≫ '<span style="color:blue">→ASCII</span>' STO
 
=={{header|V (Vlang)}}==
<syntaxhighlight lang="Rust">
enum Ctrl {
nul = 0
soh
stx
etx
eot
enq
ack
bel
bs
ht
lf
vt
ff
cr
so
si
dle
dc1
dc2
dc3
dc4
nak
syn
etb
can
em
sub
esc
fs
gs
rs
us
space
del = 127
}
 
fn main() {
println(int(Ctrl.cr))
println(int(Ctrl.del))
}
</syntaxhighlight>
 
{{out}}
<pre>
13
127
</pre>
 
Line 461 ⟶ 535:
 
Here, we create instead a ''Group'' which can contain any values in any order.
<syntaxhighlight lang="ecmascriptwren">import "./dynamic" for Group
 
var names = [
9,482

edits