This file is indexed.

/usr/share/doc/clc-intercal/html/lectures.html is in clc-intercal 1:1.0~4pre1.-94.-2-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<HTML>
    <HEAD>
	<TITLE>CLC-INTERCAL Reference</TITLE>
    </HEAD>
    <BODY>
	<H1>CLC-INTERCAL Reference</H1>
	<H2>... Classes and Lectures</H2>

	<P>
	Table of contents:
	<UL>
	    <LI><A HREF="index.html">Parent directory</A>
	    <LI><A HREF="#lectures">Classes and Lectures</A>
	</UL>
	</P>

	<H2><A NAME="lectures">Classes and Lectures</A></H2>

	<P>
	CLC-INTERCAL introduces a concept of classes and lectures which can be
	used to build object-oriented programs.
	</P>

	<P>
	Conceptually, a class is a place where you go and learn. This might differ
	from the concept by the same name in other languages, but is perfectly
	consistent with English usage of the word. To define a class, we need to
	list which subjects one can learn there. We do this using the related
	concept of <EM>lecture</EM>.
	</P>

	<P>
	A lecture is more specialised than a class, in that you learn just one
	subject. Like everything else in INTERCAL, subject are identified by a
	number; lectures, on the other hand, are identified by a label. Just for
	completeness, we mention here that classes are identified by a whirlpool
	(<CODE>@</CODE>) register.
	</P>

	<P>
	To tell the compiler that a lecture happens at (1000) in class <CODE>@2</CODE>,
	and the subject of the lecture is <CODE>#5</CODE>, you say:
<PRE>
    DO STUDY #5 AT (1000) IN CLASS @2
</PRE>
	</P>

	<P>
	There is no need to explicitely define classes. The above line implies the
	existence of a class numbered <CODE>@2</CODE>, and if several such lines
	mention the same class then we know that all these subjects are taught there.
	</P>

	<P>
	Note that the labels must exist, as the program will need to execute there.
	However, the labels only need to exist when the LEARNS statement is executed,
	and they do not need to exist when the STUDY is executed.
	</P>

	<P>
	Once you have defined a class, you might want to have some students there.
	Other languages create objects from a class. We don't. The object is there
	before, and becomes a student by asking:
<PRE>
    PLEASE ENROL :1 TO LEARN #5 + #7
</PRE>
	</P>

	<P>
	This means, look for a class which teaches subjects <CODE>#5</CODE> and
	<CODE>#7</CODE>, and make a note that <CODE>:2</CODE> now studies there.
	<CODE>:2</CODE> can also study elsewhere. This is not a problem. Other
	languages make a very big fuss about this and call it "multiple inheritance",
	but it's all very simple as you'll see soon.
	</P>

	<P>
	In fact, let's step back and define two classes:
<PRE>
    DO STUDY #5 AT (1000) IN CLASS @2
    DO STUDY #7 AT (1100) IN CLASS @2
    PLEASE STUDY #8 AT (1200) IN CLASS @2

    DO STUDY #5 AT (2000) IN CLASS @5
    DO STUDY #7 AT (2100) IN CLASS @5
    PLEASE STUDY #9 AT (2200) IN CLASS @5
</PRE>
	</P>

	<P>
	We first note that now just asking to learn <CODE>#5</CODE> and <CODE>#7</CODE>
	is not enough, as both classes teach these subjects. If you try that, you get
	a CLASS WAR error. Intuitively, both classes are trying to get you as a student.
	But this is easy to fix, just ask for <CODE>#8</CODE> or <CODE>#9</CODE>, as
	appropriate. Let's now enrol three students:
<PRE>
    DO ENROL :1 TO LEARN #8

    DO ENROL .2 TO LEARN #5 + #9

    PLEASE ENROL ,3 TO LEARN #5 + #8
    DO ENROL ,3 TO LEARN #7 + #9
</PRE>
	</P>

	<P>
	As a result, <CODE>:1</CODE> is in class <CODE>@2</CODE>, <CODE>.2</CODE> is
	in class <CODE>@5</CODE>, and <CODE>,3</CODE> is in both classes. So what
	happens when one of them wants to learn something?
<PRE>
    DO :1 LEARNS #5
    DO .2 LEARNS #5
    DO ,3 LEARNS #5
</PRE>
	</P>

	<P>
	Here the first statement will attend lecture at (1000), because <CODE>:1</CODE>
	is in class <CODE>@2</CODE>, while the second attends the night lecture at
	(2000), because <CODE>.2</CODE> is in class <CODE>@5</CODE>. What happens
	with the third statement? <CODE>,3</CODE> is in both classes, so you get
	a CLASS WAR error.
	</P>

	<P>
	If you want to start afresh, you can remove any current ENROLment with:
<PRE>
    DO ,3 GRADUATES
</PRE>
	After this, you can ENROL again, and you know for sure what class you are in.
	</P>

	<P>
	Having described the classes and students, it's about time to go to the
	lectures. This is what other languages might call methods, except that other
	languages don't select classes by example (find a class with methods "open",
	"close", and "print" - it could be a useful extension to C++, Java, and Perl)
	</P>

	<P>
	A lecture is identified by a label. When a student asks to study a subject,
	program execution continues at that label until the statement FINISH LECTURE
	is executed, at which point execution resumes where it was before. Note that
	there are separate stacks for lectures and NEXT, so FORGETting any number of
	levels will not change the return point for a lecture. It also allows very
	interesting execution paths as there are two independent ways of executing
	subroutines. For example, you can have a NEXT (or NEXT FROM) which is
	executed inside a lecture, then FINISH LECTURE. That gets back just after
	the LEARNS statement, however you are still allowed to RESUME. Just don't
	ask us where you end up executing.
	</P>

	<P>
	Within a lecture, the class register (<CODE>@</CODE><I>nnn</I>) is
	enslaved to the student. So in lecture (1000) you can use <CODE>$@2</CODE>
	for the student. The FINISH LECTURE statement automatically frees the
	class register from the student. You can change that as well, but you
	are likely to run into problems if you do.
	</P>

	<P>
	Let us conclude our discussion with an example, actually used in the Turing
	Machine program which comes with the compiler. Class <CODE>@1</CODE>
	implements 16 bit increment and decrement (inspired from the lib/plus.i
	program in C-INTERCAL's code pit, but modified to avoid using NEXT and
	similar horrors, using the much cleaner computed COME FROM). The student
	<CODE>.2</CODE> learns <CODE>#1</CODE> (increment) a total of six times,
	and <CODE>#2</CODE> (decrement) twice, so the end result is to add 4 to
	the register. As for <CODE>.1</CODE>, that just gets incremented once
	and decremented twice. And in fact the program prints MCCXXXVIII (1238)
	followed by M (1000).
<PRE>
        PLEASE STUDY #1 AT (1000) IN CLASS @1
        PLEASE STUDY #2 AT (2000) IN CLASS @1

        PLEASE ENROL .1 TO LEARN #1
        PLEASE ENROL .2 TO LEARN #1 + #2

        DO .1 &lt;- #1001
        DO .2 &lt;- #1234
        PLEASE .2 LEARNS #1
        DO .2 LEARNS #1
        DO .1 LEARNS #1
        DO .2 LEARNS #1
        DO .2 LEARNS #2
        DO .2 LEARNS #1
        PLEASE .2 LEARNS #1
        DO .1 LEARNS #2
        DO .1 LEARNS #2
        DO .2 LEARNS #1
        DO .2 LEARNS #2
        DO READ OUT .2
        PLEASE READ OUT .1
        DO GIVE UP

(1000)  PLEASE STASH .65530 + .65531 + .65532
        DO .65530 &lt;- $@1 ~ #65535
        DO .65531 &lt;- #1
        PLEASE COME FROM (1001)
        DO .65532 &lt;- .65530 ~ #1
        DO .65532 &lt;- '.65532 &#162; .65532' ~ #3
        DO .65532 &lt;- '.65532 &#162; .65532' ~ #15
        DO .65532 &lt;- '.65532 &#162; .65532' ~ #255
        DO .65532 &lt;- '.65532 &#162; .65532' ~ #65535
(1002)  DO .65532 &lt;- #1002 ~ .65532
        DO $@1 &lt;- "&#165; '.65531 &#162; "$@1 ~ #65535"'" ~ '#0 &#162; #65535'
        PLEASE RETRIEVE .65530 + .65531 + .65532
        PLEASE FINISH LECTURE
        PLEASE COME FROM .65532
        DO .65532 &lt;- #0
        DO .65530 &lt;- .65530 ~ #65534
(1001)  DO .65531 &lt;- '.65531 &#162; #1' ~ '#65535 &#162; #1'

(2000)  PLEASE STASH .65530 + .65531 + .65533
        DO .65530 &lt;- $@1 ~ #65535
        DO .65531 &lt;- #1
        PLEASE COME FROM (2001)
        DO .65533 &lt;- .65530 ~ #1
        DO .65533 &lt;- '.65533 &#162; .65533' ~ #3
        DO .65533 &lt;- '.65533 &#162; .65533' ~ #15
        DO .65533 &lt;- '.65533 &#162; .65533' ~ #255
        DO .65533 &lt;- '.65533 &#162; .65533' ~ #65535
(2002)  DO .65533 &lt;- #2002 ~ .65533
        DO .65533 &lt;- #0
        DO .65530 &lt;- .65530 ~ #65534
(2001)  DO .65531 &lt;- '.65531 &#162; #1' ~ '#65535 &#162; #1'
        PLEASE COME FROM .65533
        DO $@1 &lt;- "&#165; '.65531 &#162; "$@1 ~ #65535"'" ~ '#0 &#162; #65535'
        PLEASE RETRIEVE .65530 + .65531 + .65533
        PLEASE FINISH LECTURE
</PRE>
	</P>

	<P>
	To compile the program to Perl, save it as example.i, and use:
<PRE>
    sick -lObject example.i
</PRE>
	This produces "example.io", which is an executable. Alternatively, run it
	directly with:
<PRE>
    sick -lRun example.i
</PRE>
	</P>

	<P>
	Note that you can copy-and-paste from your browser into an (8 bit clean) text
	editor. If you save the file from the browser you'll also need to replace
	the HTML escapes with the appropriate characters.
	</P>

	<P>
	We feel no need to comment on the program, as it is self-exlanatory.
	</P>

</BODY>
</HTML>