new files

This commit is contained in:
Ingy döt Net 2013-04-10 12:38:42 -07:00
parent 3af7344581
commit 86c034bb8b
1364 changed files with 21352 additions and 0 deletions

View file

@ -0,0 +1 @@
a[0]="hello"

View file

@ -0,0 +1,11 @@
procedure Array_Collection is
A : array (-3 .. -1) of Integer := (1, 2, 3);
begin
A (-3) := 3;
A (-2) := 2;
A (-1) := 1;
end Array_Collection;

View file

@ -0,0 +1,12 @@
procedure Array_Collection is
type Array_Type is array (1 .. 3) of Integer;
A : Array_Type := (1, 2, 3);
begin
A (1) := 3;
A (2) := 2;
A (3) := 1;
end Array_Collection;

View file

@ -0,0 +1,13 @@
procedure Array_Collection is
type Array_Type is array (positive range <>) of Integer; -- may be indexed with any positive
-- Integer value
A : Array_Type(1 .. 3); -- creates an array of three integers, indexed from 1 to 3
begin
A (1) := 3;
A (2) := 2;
A (3) := 1;
end Array_Collection;

View file

@ -0,0 +1,17 @@
with Ada.Containers.Doubly_Linked_Lists;
use Ada.Containers;
procedure Doubly_Linked_List is
package DL_List_Pkg is new Doubly_Linked_Lists (Integer);
use DL_List_Pkg;
DL_List : List;
begin
DL_List.Append (1);
DL_List.Append (2);
DL_List.Append (3);
end Doubly_Linked_List;

View file

@ -0,0 +1,17 @@
with Ada.Containers.Vectors;
use Ada.Containers;
procedure Vector_Example is
package Vector_Pkg is new Vectors (Natural, Integer);
use Vector_Pkg;
V : Vector;
begin
V.Append (1);
V.Append (2);
V.Append (3);
end Vector_Example;

View file

@ -0,0 +1,11 @@
#define cSize( a ) ( sizeof(a)/sizeof(a[0]) ) /* a.size() */
int ar[10]; /* Collection<Integer> ar = new ArrayList<Integer>(10); */
ar[0] = 1; /* ar.set(0, 1); */
ar[1] = 2;
int* p; /* Iterator<Integer> p; Integer pValue; */
for (p=ar; /* for( p = ar.itereator(), pValue=p.next(); */
p<(ar+cSize(ar)); /* p.hasNext(); */
p++) { /* pValue=p.next() ) { */
printf("%d\n",*p); /* System.out.println(pValue); */
} /* } */

View file

@ -0,0 +1,4 @@
{1 "a", "Q" 10} ; commas are treated as whitespace
(hash-map 1 "a" "Q" 10) ; equivalent to the above
(let [my-map {1 "a"}]
(assoc my-map "Q" 10)) ; "adding" an element

View file

@ -0,0 +1,7 @@
include ffl/car.fs
10 car-create ar \ create a dynamic array with initial size 10
2 0 ar car-set \ ar[0] = 2
3 1 ar car-set \ ar[1] = 3
1 0 ar car-insert \ ar[0] = 1 ar[1] = 2 ar[2] = 3

View file

@ -0,0 +1 @@
[1, 2, 3, 4, 5]

View file

@ -0,0 +1,14 @@
List arrayList = new ArrayList();
arrayList.add(new Integer(0));
// alternative with primitive autoboxed to an Integer object automatically
arrayList.add(0);
//other features of ArrayList
//define the type in the arraylist, you can substitute a proprietary class in the "<>"
List<Integer> myarrlist = new ArrayList<Integer>();
//add several values to the arraylist to be summed later
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}

View file

@ -0,0 +1,5 @@
var array = [];
array.push('abc');
array.push(123);
array.push(new MyClass);
alert( array[2] );

View file

@ -0,0 +1,3 @@
numeric(5)
1:10
c(1, 3, 6, 10, 7 + 8, sqrt(441))

View file

@ -0,0 +1,36 @@
pr.=0 /*define a default for all elements for the stemmed array.*/
pr.1 =2 /*note that this array starts at 1 (one). */
pr.2 =3
pr.3 =5
pr.4 =7
pr.6 =11
pr.6 =13
pr.7 =17
pr.8 =19
pr.9 =23
pr.10=29
pr.11=31
pr.12=37
pr.13=41
pr.14=43
y.=0 /*define a default for all years. */
y.1985 = 6020
y.1986 = 7791
y.1987 = 8244
y.1988 = 10075
x = y.2000 /*X will have a value of zero (0). */
fib.0 = 0 /*arrays may start with zero (0). */
fib.1 = 1
fib.2 = 1
fib.3 = 2
fib.4 = 3
fib.5 = 5
fib.6 = 8
fib.7 =17
do n=-5 to 5 /*define an array from -5 ──► 5 */
sawtooth.n=n
end /*n*/ /*eleven elements will be defined. */

View file

@ -0,0 +1,8 @@
# creating an empty array and adding values
a = [] # => []
a[0] = 1 # => [1]
a[3] = 2 # => [1, nil, nil, 2]
# creating an array with the constructor
a = Array.new # => []

View file

@ -0,0 +1 @@
(list obj ...)

View file

@ -0,0 +1,12 @@
set c [list] ;# create an empty list
# fill it
lappend c 10 11 13
set c [linsert $c 2 "twelve goes here"]
# iterate over it
foreach elem $c {puts $elem}
# pass to a proc
proc show_size {l} {
puts [llength $l]
}
show_size $c