Time for an 2014 update…

This commit is contained in:
Ingy döt Net 2014-01-17 05:32:22 +00:00
parent 372c577f83
commit 09687c4926
2520 changed files with 34227 additions and 7318 deletions

View file

@ -11,10 +11,10 @@ push-to l "Boo"
local :l2 [ "Hi" "Boo" ]
#this prints 2
print len l
!print len l
#this prints Hi
print get-from l 0
!print get-from l 0
#this prints Boo
print pop-from l
!print pop-from l

View file

@ -1,4 +1,4 @@
#var anArray := system'Array new &type'length:5.
#var anArray := system'Array new &length:5.
anArray setAt:0:2.
system'console writeLine:(anArray@0).

View file

@ -0,0 +1,3 @@
var myArray = $array(1);
$print(myArray[0]);

View file

@ -1,9 +1,9 @@
/*REXX program demonstrates array usage. */
a.='not found' /*value for all a.xxx (so far). */
/*REXX program demonstrates a simple array usage. */
a.='not found' /*value for all a.xxx (so far).*/
do j=1 to 100 /*start at 1, define 100 elements*/
a.j=-j*100 /*define as negative J thousand. */
end /*j*/ /*the above defines 100 elements.*/
do j=1 to 100 /*start at 1, define 100 array elements.*/
a.j=-j*100 /*define element as negative J thousand.*/
end /*the above defines 100 elements. */
say 'element 50 is:' a.50
say 'element 50 is:' a.50
say 'element 3000 is:' a.3000
/*stick a fork in it, we're done.*/

View file

@ -1,13 +1,11 @@
/*REXX program demonstrates array usage with mimicry. */
/*REXX program demonstrates array usage with mimicry. */
a. = 'not found' /*value for all a.xxx (so far). */
do j=1 to 100 /*start at 1, define 100 elements*/
a.j = -j * 100 /*define element as -J hundred. */
end /*j*/ /*the above defines 100 elements.*/
do j=1 to 100 /*start at 1, define 100 elements*/
a.j = -j * 100 /*define element as -J thousand.*/
end /*j*/ /*the above defines 100 elements.*/
say 'element 50 is:' a(50)
say 'element 50 is:' a(50)
say 'element 3000 is:' a(3000)
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────A subroutine────────────────────────*/
a: _a_ = arg(1); return a._a_
a: _a_ = arg(1); return a._a_

View file

@ -1,9 +1,11 @@
/*REXX program demonstrates array usage with assigned default.*/
a.=00 /*value for all a.xxx (so far). */
/*REXX program demonstrates array usage with mimicry. */
a. = 'not found' /*value for all a.xxx (so far). */
do j=1 to 100 /*start at 1, define 100 elements*/
a.j = -j * 100 /*define element as -J hundred. */
end /*j*/ /*the above defines 100 elements.*/
do j=1 to 100 /*start at 1, define 100 array elements.*/
a.j=-j*100 /*define element as negative J thousand.*/
end /*the above defines 100 elements. */
say 'element 50 is:' a.50
say 'element 3000 is:' a.3000
say 'element 50 is:' a(50)
say 'element 3000 is:' a(3000)
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────A subroutine────────────────────────*/
a: _a_ = arg(1); return a._a_

View file

@ -1,10 +1,10 @@
/*REXX program demonstrates array usage. */
array.='out of range' /*for now, define ALL elements to this. */
do j=-3000 to 3000 /*start at -3k, going up to +3k. */
array.j=j**2 /*define element as it's square. */
end /*the above defines 6,001 elements. */
/*REXX program demonstrates array usage (with elements out-of-range).*/
array. = 'out of range' /*define ALL elements to this. */
do j=-3000 to 3000 /*start at -3k, going up to +3k.*/
array.j=j**2 /*define element as it's square. */
end /*j*/ /* [↑] defines 6,001 elements. */
g=-7
say g "squared is:" array.g
say 7000 "squared is:" array.7000
say g "squared is:" array.g
say 7000 "squared is:" array.7000
/*stick a fork in it, we're done.*/

View file

@ -1,16 +1,17 @@
/*REXX program demonstrates disjointed array usage. */
yr.='year not supported' /*value for all yr.xxx (so far). */
/*REXX program demonstrates disjointed array usage. */
yr. = 'year not supported' /*value for all yr.xxx (so far).*/
do k=600 to 1100 /*Define a bunch of years prior to 1800.*/
yr.k=k "AD"
end
do k=600 to 1100 /*a bunch of years prior to 1800.*/
yr.k=k "AD" /*Kth element as the year itself.*/
end /*k*/ /* [↑] defines 501 elements.*/
do j=1800 to 2100 /*start at 1800, define a bunch of years*/
yr.j=j 'AD' /*define Jth element as the year itself.*/
end /*the above defines 301 elements. */
do j=1800 to 2100 /*start at 1800, define a bunch. */
yr.j=j 'AD' /*Jth element as the year itself.*/
end /*j*/ /* [↑] defines 301 elements.*/
year=1946
say 'DOB' year "is:" yr.year
year=1744
say 'DOB' year "is:" yr.year
/*stick a fork in it, we're done.*/

View file

@ -1,29 +1,27 @@
/*REXX program demonstrates array usage: sparse and disjointed. */
yyy = -55
a.yyy = 1e9 /*REXX must use this mechanism for neg idx.*/
/*REXX program demonstrates array usage: sparse and disjointed. */
yyy = -55 /*REXX must use this mechanism···*/
a.yyy = 1e9 /*··· when assigning neg indices.*/
a.1=1000
a.2=2000.0001
a.1 = 1000
a.2 = 2000.0001
a.7 = 7000
a.2012 = 'out here in left field.'
a.cat='civet, but not a true cat --- belonging to the family Viverridae'
a.civet="A.K.A.: toddycats"
/*------------------------------------------------------------------------
Array elements need not be continous (nor even defined). They can hold
any nanner of numbers, or strings (which can include any characters,
including null or '00'x characters).
Array elements need not be numeric, as the above code demonstrates.
Indeed, the element "name" can be ANYTHING, even non-displayable
characters. To illustrate:
--------------------------------------------------------------------------*/
a.cat = 'civet, but not a true cat belonging to the family Viverridae'
a.civet = "A.K.A.: toddycats"
/*┌────────────────────────────────────────────────────────────────────┐
Array elements need not be continuous (nor even defined). They
can hold any manner of numbers, or strings (which can include any
characters, including null or '00'x characters).
Array elements need not be numeric, as the above code demonstrates.
Indeed, the element "name" can be ANYTHING, even non-displayable
characters. To illustrate []:
*/
stuff=')g.u.t.s( or ½ of an intestine!'
a.stuff=44
/*--------------------------------------------------------------
where the element name has special characters, blanks, and
the glyph of one-half, as well as the symbol used in REXX to
indentify stemmed arrays (the period).
----------------------------------------------------------------*/
/*┌────────────────────────────────────────────────────────────────────┐
where the element name has special characters: blanks, and the
glyph of one-half (½), as well as the symbol used in REXX to
identify stemmed arrays (the period).
*/
/*stick a fork in it, we're done.*/