Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,16 @@
with Ada.Text_IO; use Ada.Text_IO;
with System;
procedure Array_Length is
Fruits : constant array (Positive range <>) of access constant String
:= (new String'("orange"),
new String'("apple"));
Memory_Size : constant Integer := Fruits'Size / System.Storage_Unit;
begin
Put_Line ("Number of elements : " & Fruits'Length'Image);
Put_Line ("Array memory Size : " & Memory_Size'Image & " bytes" );
Put_Line (" " & Integer'Image (Memory_Size * System.Storage_Unit / System.Word_Size) & " words" );
end Array_Length;

View file

@ -0,0 +1,3 @@
string[] fruit = {"apple", "orange"};
int length = fruit.length;
write("The length of the fruit array is ", length);

View file

@ -0,0 +1,9 @@
Opt('MustDeclareVars',1) ; 1 = Variables must be pre-declared.
Local $aArray[2] = ["Apple", "Orange"]
Local $Max = UBound($aArray)
ConsoleWrite("Elements in array: " & $Max & @CRLF)
For $i = 0 To $Max - 1
ConsoleWrite("aArray[" & $i & "] = '" & $aArray[$i] & "'" & @CRLF)
Next

View file

@ -0,0 +1,4 @@
fun main() {
arr := ["apple", "orange"]
println(arr.length)
}

View file

@ -0,0 +1,40 @@
identification division.
program-id. array-length.
environment division.
configuration section.
repository.
function all intrinsic.
data division.
working-storage section.
01 table-one.
05 str-field pic x(7) occurs 0 to 5 depending on t1.
77 t1 pic 99.
procedure division.
array-length-main.
perform initialize-table
perform display-table-info
goback.
initialize-table.
move 1 to t1
move "apples" to str-field(t1)
add 1 to t1
move "oranges" to str-field(t1).
*> add an extra element and then retract table size
add 1 to t1
move "bananas" to str-field(t1).
subtract 1 from t1
.
display-table-info.
display "Elements: " t1 ", using " length(table-one) " bytes"
display table-one
.
end program array-length.

View file

@ -0,0 +1,2 @@
(length ["apple" "orange"])
=> 2

View file

@ -0,0 +1,18 @@
sequence s = {"apple","orange",2.95} -- Euphoria doesn't care what you put in a sequence
? length(s)
3 -- three objects
? length(s[1])
5 -- apple has 5 characters
? length(s[1][$])
1 -- 'e' is an atomic value
? length(s[$])
1 -- 2.95 is an atomic value

View file

@ -0,0 +1,10 @@
import gleam/int
import gleam/io
import gleam/list
pub fn main() {
["apple", "orange"]
|> list.length
|> int.to_string
|> io.println
}

View file

@ -0,0 +1,3 @@
array[1] = "apple"
array[2] = "orange"
TextWindow.WriteLine(Array.GetItemCount(array))

View file

@ -0,0 +1,6 @@
///|
fn main {
let array = ["apple", "orange"]
let length = array.length()
println(length)
}

View file

@ -0,0 +1,17 @@
REM https://github.com/Eva-Broccoli/OPL-Rosetta-Code/blob/main/Arraylen.opl
PROC main:
LOCAL array$(2,6),i%
ONERR errhand
array${1}="apple"
array${2}="orange"
i%=1
WHILE 1
IF array$(i%)<>""
i%=i%+1
ENDIF
ENDWH
errhand::
ONERR OFF
PRINT "Array length is",i%-1
GET
ENDP

View file

@ -0,0 +1,9 @@
uses console
'indexbase 1 by default
dim fruit(2) as string = {"apple", "orange"}
dim length as integer = ubound(fruit) - lbound(fruit) + 1
print "The length of the fruit array is ", length
waitkey

View file

@ -0,0 +1,3 @@
$Array = @( "Apple", "Orange" )
$Array.Count
$Array.Length

View file

@ -0,0 +1,111 @@
# riscv assembly raspberry pico2 rp2350
# program lenstring.s
# connexion putty com3
/*********************************************/
/* CONSTANTES */
/********************************************/
/* for this file see risc-v task include a file */
.include "../../constantesRiscv.inc"
.equ BUFFERSIZE, 255
/*******************************************/
/* INITIALED DATAS */
/*******************************************/
.data
szMessStart: .asciz "Program riscv start.\r\n"
szMessEndOk: .asciz "Program riscv end OK.\r\n"
szCariageReturn: .asciz "\r\n"
szMessLenString: .asciz "The lenght of string "
szMessLenString1: .asciz " is "
szString1: .asciz "Apple"
szString2: .asciz "Orange"
.align 2
/*******************************************/
/* UNINITIALED DATA */
/*******************************************/
.bss
sConvArea: .skip 24
.align 2
/**********************************************/
/* SECTION CODE */
/**********************************************/
.text
.global main
main:
call stdio_init_all # général init
1: # start loop connexion
li a0,0 # raz argument register
call tud_cdc_n_connected # waiting for USB connection
beqz a0,1b # return code = zero ?
la a0,szMessStart # message address
call writeString # display message
la s0,szString1 # adresse string 1
mv a0,s0
call stringlength # len string
la a1,sConvArea
call conversion10 # call decimal conversion
la a0,szMessLenString
call writeString
mv a0,s0
call writeString
la a0,szMessLenString1
call writeString
la a0,sConvArea # display result message
call writeString
la a0,szCariageReturn
call writeString
la s0,szString2 # adresse string 2
mv a0,s0
call stringlength # len string
la a1,sConvArea
call conversion10 # call decimal conversion
la a0,szMessLenString
call writeString
mv a0,s0
call writeString
la a0,szMessLenString1
call writeString
la a0,sConvArea # display result message
call writeString
la a0,szCariageReturn
call writeString
la a0,szMessEndOk # message address
call writeString # display message
call getchar
100: # final loop
j 100b
/***************************************************/
/* compute string length */
/***************************************************/
# a0 contains string e
# a0 return length
stringlength:
addi sp, sp, -4 # reserve stack
sw ra, 0(sp) # save registers @ save registers
li t1,-1 # init counter
1: # loop
addi t1,t1,1 # increment counter
add t0,a0,t1 # compute byte address
lbu t2,(t0) # load byte string
bnez t2,1b # zero final ?
mv a0,t1 #return length
100:
lw ra, 0(sp)
addi sp, sp, 4
ret
/************************************/
/* file include Fonctions */
/***********************************/
/* for this file see risc-v task include a file */
.include "../../includeFunctions.s"

View file

@ -0,0 +1,3 @@
let fruits = ["apple", "orange"]
Js.log(Js.Array.length(fruits))

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>ReScript: Array.length()</title>
<style rel="stylesheet" type="text/css">
body { color:#EEE; background-color:#888; }
</style>
<script>var exports = {};</script>
<script src="./arrlen.js"></script>
</head>
<body>
</body>
</html>

View file

@ -0,0 +1,2 @@
>> length? ["apples" "oranges"]
== 2

View file

@ -0,0 +1 @@
print length? { "apple" "orange" }

View file

@ -0,0 +1,2 @@
arr = Array("apple","orange")
WScript.StdOut.WriteLine UBound(arr) - LBound(arr) + 1

View file

@ -0,0 +1,13 @@
!YS-v0
exprs =::
- '+["apple" "orange"]'
- 'ARGS'
- '10 .. 20'
- 'range(10 20)'
- '\\A .. \\Z'
- '"Hello, world!"'
each expr exprs:
len =: expr:eval:count
say: "The length of '$expr' is $len"