langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
38
Task/Literals-Integer/NetRexx/literals-integer.netrexx
Normal file
38
Task/Literals-Integer/NetRexx/literals-integer.netrexx
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols
|
||||
|
||||
iv = 8; say '8'.right(20) '==' iv.right(8) -- 8
|
||||
iv = -8; say '-8'.right(20) '==' iv.right(8) -- -8
|
||||
iv = 1x8; say '1x8'.right(20) '==' iv.right(8) -- -8
|
||||
iv = 2x8; say '2x8'.right(20) '==' iv.right(8) -- 8
|
||||
iv = 2x08; say '2x08'.right(20) '==' iv.right(8) -- 8
|
||||
iv = 0x08; say '0x08'.right(20) '==' iv.right(8) -- 8
|
||||
iv = 0x10; say '0x10'.right(20) '==' iv.right(8) -- 16
|
||||
iv = 0x81; say '0x81'.right(20) '==' iv.right(8) -- 129
|
||||
iv = 2x81; say '2x81'.right(20) '==' iv.right(8) -- -127
|
||||
iv = 3x81; say '3x81'.right(20) '==' iv.right(8) -- 129
|
||||
iv = 4x81; say '4x81'.right(20) '==' iv.right(8) -- 129
|
||||
iv = 04x81; say '04x81'.right(20) '==' iv.right(8) -- 129
|
||||
iv = 16x81; say '16x81'.right(20) '==' iv.right(8) -- 129
|
||||
iv = 4xF081; say '4xF081'.right(20) '==' iv.right(8) -- -3967
|
||||
iv = 8xF081; say '8xF081'.right(20) '==' iv.right(8) -- 61569
|
||||
iv = 0Xf081; say '0Xf081'.right(20) '==' iv.right(8) -- 61569
|
||||
iv = 0xffff; say '0xffff'.right(20) '==' iv.right(8) -- 65535
|
||||
iv = 4xffff; say '4xffff'.right(20) '==' iv.right(8) -- -1
|
||||
iv = 8xffff; say '8xffff'.right(20) '==' iv.right(8) -- 65535
|
||||
iv = 1b0; say '1b0'.right(20) '==' iv.right(8) -- 0
|
||||
iv = 1b1; say '1b1'.right(20) '==' iv.right(8) -- -1
|
||||
iv = 2b1; say '2b1'.right(20) '==' iv.right(8) -- 1
|
||||
iv = 0b10; say '0b10'.right(20) '==' iv.right(8) -- 2
|
||||
iv = 2b10; say '2b10'.right(20) '==' iv.right(8) -- -2
|
||||
iv = 3b10; say '3b10'.right(20) '==' iv.right(8) -- 2
|
||||
iv = 0b100; say '0b100'.right(20) '==' iv.right(8) -- 4
|
||||
iv = 3b100; say '3b100'.right(20) '==' iv.right(8) -- -4
|
||||
iv = 4b100; say '4b100'.right(20) '==' iv.right(8) -- 4
|
||||
iv = 4b1000; say '4b1000'.right(20) '==' iv.right(8) -- -8
|
||||
iv = 8B1000; say '8B1000'.right(20) '==' iv.right(8) -- 8
|
||||
iv = 00B1111111111111111; say '00B1111111111111111'.right(20) '==' iv.right(8) -- 65535
|
||||
iv = 16B1111111111111111; say '16B1111111111111111'.right(20) '==' iv.right(8) -- -1
|
||||
iv = 32B1111111111111111; say '32B1111111111111111'.right(20) '==' iv.right(8) -- 65535
|
||||
|
||||
return
|
||||
8
Task/Literals-Integer/OCaml/literals-integer.ocaml
Normal file
8
Task/Literals-Integer/OCaml/literals-integer.ocaml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# 727 = 0b1011010111;;
|
||||
- : bool = true
|
||||
# 727 = 0o1327;;
|
||||
- : bool = true
|
||||
# 727 = 0x2d7;;
|
||||
- : bool = true
|
||||
# 12345 = 12_345 (* underscores are ignored; useful for keeping track of places *);;
|
||||
- : bool = true
|
||||
7
Task/Literals-Integer/Objeck/literals-integer.objeck
Normal file
7
Task/Literals-Integer/Objeck/literals-integer.objeck
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
bundle Default {
|
||||
class Literal {
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
(727 = 0x2d7)->PrintLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Task/Literals-Integer/Oz/literals-integer-1.oz
Normal file
7
Task/Literals-Integer/Oz/literals-integer-1.oz
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
try
|
||||
%% binary octal dec. hexadecimal
|
||||
0b1011010111 = 01327 = 727 = 0x2d7
|
||||
{Show success}
|
||||
catch _ then
|
||||
{Show unexpectedError}
|
||||
end
|
||||
1
Task/Literals-Integer/Oz/literals-integer-2.oz
Normal file
1
Task/Literals-Integer/Oz/literals-integer-2.oz
Normal file
|
|
@ -0,0 +1 @@
|
|||
X = ~42
|
||||
4
Task/Literals-Integer/PL-I/literals-integer.pli
Normal file
4
Task/Literals-Integer/PL-I/literals-integer.pli
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
12345
|
||||
'b4'xn /* a hexadecimal literal integer. */
|
||||
'ffff_ffff'xn /* a longer hexadecimal hexadecimal integer. */
|
||||
1101b /* a binary integer, of value decimal 13. */
|
||||
14
Task/Literals-Integer/Perl-6/literals-integer.pl6
Normal file
14
Task/Literals-Integer/Perl-6/literals-integer.pl6
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
say 255;
|
||||
say 0d255;
|
||||
say 0xff;
|
||||
say 0o377;
|
||||
say 0b1111_1111;
|
||||
|
||||
say :10<255>;
|
||||
say :16<ff>;
|
||||
say :8<377>;
|
||||
say :2<1111_1111>;
|
||||
say :3<100110>;
|
||||
say :4<3333>;
|
||||
say :12<193>;
|
||||
say :36<73>;
|
||||
5
Task/Literals-Integer/PostScript/literals-integer.ps
Normal file
5
Task/Literals-Integer/PostScript/literals-integer.ps
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
123 % 123
|
||||
8#1777 % 1023
|
||||
16#FFFE % 65534
|
||||
2#11011 % 27
|
||||
5#44 % 24
|
||||
2
Task/Literals-Integer/PowerShell/literals-integer-1.psh
Normal file
2
Task/Literals-Integer/PowerShell/literals-integer-1.psh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
727 # base 10
|
||||
0x2d7 # base 16
|
||||
4
Task/Literals-Integer/PowerShell/literals-integer-2.psh
Normal file
4
Task/Literals-Integer/PowerShell/literals-integer-2.psh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
3KB # 3072
|
||||
3MB # 3145728
|
||||
3GB # 3221225472
|
||||
3TB # 3298534883328
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
x = 15 ;15 in base 10
|
||||
x = %1111 ;15 in base 2
|
||||
x = $f ;15 in base 16
|
||||
|
|
@ -0,0 +1 @@
|
|||
x = 'a' ;129
|
||||
1
Task/Literals-Integer/REBOL/literals-integer.rebol
Normal file
1
Task/Literals-Integer/REBOL/literals-integer.rebol
Normal file
|
|
@ -0,0 +1 @@
|
|||
1
|
||||
5
Task/Literals-Integer/Retro/literals-integer.retro
Normal file
5
Task/Literals-Integer/Retro/literals-integer.retro
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#100 ( decimal )
|
||||
%100 ( binary )
|
||||
$100 ( hex )
|
||||
'c ( ascii character )
|
||||
100 ( number in current base )
|
||||
11
Task/Literals-Integer/Seed7/literals-integer.seed7
Normal file
11
Task/Literals-Integer/Seed7/literals-integer.seed7
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const proc: main is func
|
||||
begin
|
||||
writeln(727);
|
||||
writeln(32#MN);
|
||||
writeln(16#2D7);
|
||||
writeln(10#727);
|
||||
writeln(8#1327);
|
||||
writeln(2#1011010111);
|
||||
end func;
|
||||
1
Task/Literals-Integer/Slate/literals-integer.slate
Normal file
1
Task/Literals-Integer/Slate/literals-integer.slate
Normal file
|
|
@ -0,0 +1 @@
|
|||
2r1011010111 + 8r1327 + 10r727 + 16r2d7 / 4
|
||||
11
Task/Literals-Integer/Standard-ML/literals-integer.ml
Normal file
11
Task/Literals-Integer/Standard-ML/literals-integer.ml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
- 727 = 0x2d7;
|
||||
val it = true : bool
|
||||
- 727 = Word.toInt 0w727;
|
||||
val it = true : bool
|
||||
- 0w727 = 0wx2d7;
|
||||
val it = true : bool
|
||||
- ~727; (* negative number;
|
||||
* ~ is the unary negation operator for all numbers, including reals and ints;
|
||||
* worth mentioning because it's unusual
|
||||
*)
|
||||
val it = ~727 : int
|
||||
1
Task/Literals-Integer/TI-89-BASIC/literals-integer.ti-89
Normal file
1
Task/Literals-Integer/TI-89-BASIC/literals-integer.ti-89
Normal file
|
|
@ -0,0 +1 @@
|
|||
0b10000001 = 129 = 0h81
|
||||
4
Task/Literals-Integer/UNIX-Shell/literals-integer-1.sh
Normal file
4
Task/Literals-Integer/UNIX-Shell/literals-integer-1.sh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
$ expr 700 - 1
|
||||
699
|
||||
$ expr 0700 - 01
|
||||
699
|
||||
7
Task/Literals-Integer/UNIX-Shell/literals-integer-2.sh
Normal file
7
Task/Literals-Integer/UNIX-Shell/literals-integer-2.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
dec=727
|
||||
oct=$(( 01327 ))
|
||||
bin=$(( 2#1011010111 ))
|
||||
hex=$(( 0x2d7 ))
|
||||
# or e.g.
|
||||
let bin=2#1011010111
|
||||
let "baseXX = 20#1g7"
|
||||
7
Task/Literals-Integer/UNIX-Shell/literals-integer-3.sh
Normal file
7
Task/Literals-Integer/UNIX-Shell/literals-integer-3.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
dec=727
|
||||
oct=$(( 01327 ))
|
||||
bin=$(( 2#1011010111 ))
|
||||
hex=$(( 0x2d7 ))
|
||||
# or e.g.
|
||||
(( bin = 2#1011010111 ))
|
||||
(( baseXX = 20#1g7 ))
|
||||
1
Task/Literals-Integer/Ursala/literals-integer-1.ursala
Normal file
1
Task/Literals-Integer/Ursala/literals-integer-1.ursala
Normal file
|
|
@ -0,0 +1 @@
|
|||
n = 724
|
||||
1
Task/Literals-Integer/Ursala/literals-integer-2.ursala
Normal file
1
Task/Literals-Integer/Ursala/literals-integer-2.ursala
Normal file
|
|
@ -0,0 +1 @@
|
|||
z = -35
|
||||
1
Task/Literals-Integer/Ursala/literals-integer-3.ursala
Normal file
1
Task/Literals-Integer/Ursala/literals-integer-3.ursala
Normal file
|
|
@ -0,0 +1 @@
|
|||
m = -2/3
|
||||
1
Task/Literals-Integer/Ursala/literals-integer-4.ursala
Normal file
1
Task/Literals-Integer/Ursala/literals-integer-4.ursala
Normal file
|
|
@ -0,0 +1 @@
|
|||
t = 4534934521_
|
||||
7
Task/Literals-Integer/XPL0/literals-integer.xpl0
Normal file
7
Task/Literals-Integer/XPL0/literals-integer.xpl0
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
code CrLf=9, IntOut=11;
|
||||
def A=123, B=$123, C=%11_0011, D=^A;
|
||||
[IntOut(0, A); CrLf(0); \decimal
|
||||
IntOut(0, B); CrLf(0); \hex
|
||||
IntOut(0, C); CrLf(0); \binary
|
||||
IntOut(0, D); CrLf(0); \ASCII
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue