2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,6 +1,7 @@
|
|||
{{omit from|AWK}}
|
||||
{{omit from|Clojure}}
|
||||
{{omit from|E}}
|
||||
{{omit from|E}}ruby
|
||||
|
||||
{{omit from|gnuplot}}
|
||||
{{omit from|Groovy}}
|
||||
{{omit from|GUISS|Does not have variables.}}
|
||||
|
|
|
|||
61
Task/Variable-size-Get/COBOL/variable-size-get.cobol
Normal file
61
Task/Variable-size-Get/COBOL/variable-size-get.cobol
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
identification division.
|
||||
program-id. variable-size-get.
|
||||
|
||||
environment division.
|
||||
configuration section.
|
||||
repository.
|
||||
function all intrinsic.
|
||||
|
||||
data division.
|
||||
working-storage section.
|
||||
01 bc-len constant as length of binary-char.
|
||||
01 fd-34-len constant as length of float-decimal-34.
|
||||
|
||||
77 fixed-character pic x(13).
|
||||
77 fixed-national pic n(13).
|
||||
77 fixed-nine pic s9(5).
|
||||
77 fixed-separate pic s9(5) sign trailing separate.
|
||||
77 computable-field pic s9(5) usage computational-5.
|
||||
77 formatted-field pic +z(4),9.
|
||||
|
||||
77 binary-field usage binary-double.
|
||||
01 pointer-item usage pointer.
|
||||
|
||||
01 group-item.
|
||||
05 first-inner pic x occurs 0 to 3 times depending on odo.
|
||||
05 second-inner pic x occurs 0 to 5 times depending on odo-2.
|
||||
01 odo usage index value 2.
|
||||
01 odo-2 usage index value 4.
|
||||
|
||||
procedure division.
|
||||
sample-main.
|
||||
display "Size of:"
|
||||
display "BINARY-CHAR : " bc-len
|
||||
display " bc-len constant : " byte-length(bc-len)
|
||||
display "FLOAT-DECIMAL-34 : " fd-34-len
|
||||
display " fd-34-len constant : " byte-length(fd-34-len)
|
||||
|
||||
display "PIC X(13) field : " length of fixed-character
|
||||
display "PIC N(13) field : " length of fixed-national
|
||||
|
||||
display "PIC S9(5) field : " length of fixed-nine
|
||||
display "PIC S9(5) sign separate : " length of fixed-separate
|
||||
display "PIC S9(5) COMP-5 : " length of computable-field
|
||||
|
||||
display "ALPHANUMERIC-EDITED : " length(formatted-field)
|
||||
|
||||
display "BINARY-DOUBLE field : " byte-length(binary-field)
|
||||
display "POINTER field : " length(pointer-item)
|
||||
>>IF P64 IS SET
|
||||
display " sizeof(char *) > 4"
|
||||
>>ELSE
|
||||
display " sizeof(char *) = 4"
|
||||
>>END-IF
|
||||
|
||||
display "Complex ODO at 2 and 4 : " length of group-item
|
||||
set odo down by 1.
|
||||
set odo-2 up by 1.
|
||||
display "Complex ODO at 1 and 5 : " length(group-item)
|
||||
|
||||
goback.
|
||||
end program variable-size-get.
|
||||
22
Task/Variable-size-Get/Elixir/variable-size-get.elixir
Normal file
22
Task/Variable-size-Get/Elixir/variable-size-get.elixir
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
list = [1,2,3]
|
||||
IO.puts length(list) #=> 3
|
||||
|
||||
tuple = {1,2,3,4}
|
||||
IO.puts tuple_size(tuple) #=> 4
|
||||
|
||||
string = "Elixir"
|
||||
IO.puts String.length(string) #=> 6
|
||||
IO.puts byte_size(string) #=> 6
|
||||
IO.puts bit_size(string) #=> 48
|
||||
|
||||
utf8 = "○×△"
|
||||
IO.puts String.length(utf8) #=> 3
|
||||
IO.puts byte_size(utf8) #=> 8
|
||||
IO.puts bit_size(utf8) #=> 64
|
||||
|
||||
bitstring = <<3 :: 2>>
|
||||
IO.puts byte_size(bitstring) #=> 1
|
||||
IO.puts bit_size(bitstring) #=> 2
|
||||
|
||||
map = Map.new([{:b, 1}, {:a, 2}])
|
||||
IO.puts map_size(map) #=> 2
|
||||
Loading…
Add table
Add a link
Reference in a new issue