Added upstream from http://ftp.icm.edu.pl/pub/loglan/
[loglan.git] / HTML / MicroMan / adjustab.htm
1 <!doctype html public "-//IETF//DTD HTML//EN">\r
2 <HTML>\r
3 \r
4 <HEAD>\r
5 \r
6 <TITLE>Adjustable arrays</TITLE>\r
7 \r
8 <META NAME="GENERATOR" CONTENT="Internet Assistant for Word 1.0Z">\r
9 <META NAME="AUTHOR" CONTENT="NOM">\r
10 </HEAD>\r
11 \r
12 <BODY>\r
13 \r
14 <H4><U><I>Loglan 82, A micro-manual of the programming language\r
15 - Basic constructs and facilities</I></U></H4>\r
16 \r
17 <H1><IMG ALIGN=MIDDLE SRC="gifs/logo2.gif"> 6) Adjustable arrays\r
18 </H1>\r
19 <HR>\r
20 \r
21 <P>\r
22 In LOGLAN-82 arrays are adjustable at run time. They may be treated\r
23 as objects of specified standard type with index instead of identifier\r
24 selecting an attribute. An adjustable array should be declare\r
25 somewhere among the lists of declarations and then may be generated\r
26 in the sequence of statements.\r
27 <P>\r
28 Example:\r
29 <P>\r
30 <IMG SRC="gifs/aa01.gif"> \r
31 <P>\r
32 A variable A is an array variable. Its value should be the reference\r
33 to an integer array, i.e. a composite object consisting of integer\r
34 components each one defined by an integer index.\r
35 <P>\r
36 Array generation statement:\r
37 <P>\r
38 <IMG SRC="gifs/aa02.gif"> \r
39 <P>\r
40 allocates a one-dimensional integer array with the index bounds\r
41 1,n , and assigns its address to variable A.\r
42 <P>\r
43 The figure below illustrates this situation:\r
44 <P>\r
45 <IMG SRC="gifs/Fig0501.gif"> \r
46 <P>\r
47 A general case of array generation statement has the form:\r
48 <P>\r
49 <IMG SRC="gifs/aa03.gif"> \r
50 <P>\r
51 where lower and upper are arithmetic expressions which define\r
52 the range of the array index.\r
53 <P>\r
54 Example:\r
55 <P>\r
56 Two-dimensional array declaration :\r
57 <P>\r
58 <IMG SRC="gifs/aa04.gif"> \r
59 <P>\r
60 and generation:\r
61 <P>\r
62 <IMG SRC="gifs/aa05.gif"> \r
63 <P>\r
64 create the structure:\r
65 <P>\r
66 <IMG SRC="gifs/Fig0502.gif"> \r
67 <P>\r
68 <IMG SRC="gifs/aa06.gif"> \r
69 <P>\r
70 Array A is the square array n by n. Each element A(i) , 1&lt;=i&lt;=n\r
71 contains the address of row A(i,j), 1&lt;=j&lt;=n. Array B is\r
72 the lower-triangular array. Each element B(i), 1&lt;=i&lt;=n,\r
73 contains the address of row B(i,j), 1&lt;=j&lt;=i. Thus an assignment\r
74 statement A(n,n):=B(n,n) transmits real value B(n,n) to real variable\r
75 A(n,n). Assignment B(1):=A(1) transmits the address of the first\r
76 row of A to variable B(1). Finally assignment B(1):=copy (A(1))\r
77 creates a copy of the first row of A and assigns its address to\r
78 B(1).\r
79 <P>\r
80 Upper and lower bounds of an adjustable array A are determined\r
81 by standard operators lower(A) and upper(A).\r
82 <P>\r
83 Example:\r
84 <P>\r
85 <IMG SRC="gifs/aa07.gif"> \r
86 <P>\r
87 If an array variable A refers to no array its value is equal none\r
88 (the standard default value of any array variable). An attempt\r
89 to access an array element (e.g. A(i)) or a bound (e.g. lower(A)),\r
90 where A is none, raises a run time error. <HR>\r
91 \r
92 <P>\r
93 <hr>\r
94 <A HREF="classes.htm"><IMG SRC="gifs/PrevPage.gif"></A> <A HREF="homepage.htm">\r
95 <IMG SRC="gifs/HomePage.gif"></A> \r
96 <A HREF="coroutin.htm"><IMG SRC="gifs/NextPage.gif"></A>\r
97 <HR>\r
98 \r
99 <ADDRESS>\r
100 Last update 02/07/95 \r
101 </ADDRESS>\r
102 \r
103 <ADDRESS>\r
104 Comments, suggestions and critiques are welcome to : <A HREF="mailto:linfo062@crisv2.univ-pau.fr">linfo062@crisv2.univ-pau.fr</A>\r
105 \r
106 </ADDRESS>\r
107 \r
108 </BODY>\r
109 \r
110 </HTML>\r