Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,64 +0,0 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers.Vectors;
procedure Main is
package int_vector is new Ada.Containers.Vectors
(Index_Type => Natural, Element_Type => Integer);
use int_vector;
summing_values : Vector := Empty_Vector;
prod : Integer := 1;
sum : Integer := 0;
x : Integer := 5;
y : Integer := -5;
z : Integer := -2;
N : Integer;
begin
N := -3;
while N <= 3**3 loop
summing_values.Append (N);
N := N + 3;
end loop;
N := -7;
while N <= 7 loop
summing_values.Append (N);
N := N + x;
end loop;
for I in 555 .. 550 - y loop
summing_values.Append (I);
end loop;
N := 22;
while N >= -28 loop
summing_values.Append (N);
N := N - 3;
end loop;
for I in 1_927 .. 1_939 loop
summing_values.Append (I);
end loop;
N := x;
while N >= y loop
summing_values.Append (N);
N := N + z;
end loop;
for I in 11**x .. 11**x + 1 loop
summing_values.Append (I);
end loop;
for value of summing_values loop
sum := sum + abs (value);
if abs (prod) < 2**27 and then value /= 0 then
prod := prod * value;
end if;
end loop;
Put_Line ("sum = " & sum'Image);
Put_Line ("prod = " & prod'Image);
end Main;

View file

@ -1,59 +0,0 @@
Rebol [
title: "Rosetta code: Loops/With multiple ranges"
file: %Loops-With_multiple_ranges.r3
url: https://rosettacode.org/wiki/Loops/With_multiple_ranges
needs: 3.0.0
note: {Based on Rosetta Code Red language task solution}
]
;; Define a function that iterates over multiple ranges
for-ranges: function/with ['word ranges body][
;; Clear temporary buffer
inp: clear []
;; Bind ranges dialect to context of this function
bind ranges self
foreach c reduce ranges [append inp c]
foreach i inp [set word i do body]
] context [
inp: copy []
;; Define a custom operator 'to' that creates a range from start to end
;- Note: `to` function redefinition!
to: make op! function [start end][
res: copy []
repeat n 1 + absolute to-integer end - start [
append res start + either start > end [1 - n][n - 1]
]
]
;; Define a custom operator 'by' that extracts every nth element from a series
by: make op! function [s w] [extract s absolute w]
]
;; Initialize variables
prod: 1
sum: 0
x: +5
y: -5
z: -2
one: 1
three: 3
seven: 7
;; Execute for-ranges with variable 'j' over multiple range expressions
for-ranges j [
0 - three to (3 ** 3) by three
0 - seven to seven by x
555 to (550 - y)
22 to -28 by (0 - three)
1927 to 1939
x to y by z
11 ** x to (11 ** x + one)
][
;; Body of the loop executed for each value of j
;; Add absolute value of j to sum
sum: to-integer sum + absolute j
;; Multiply prod by j if conditions are met:
;; - absolute value of prod is less than 2^27 (134,217,728)
;; - j is not zero (to avoid making prod zero)
if all [(absolute prod) < power 2 27 j <> 0] [prod: prod * j]
]
;; Print the final results
print ["sum: " sum "^/prod:" prod]