This file is indexed.

/usr/lib/swi-prolog/doc/Manual/examineprog.html is in swi-prolog-nox 6.6.4-2ubuntu1.

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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<title>SWI-Prolog 7.1.10 Reference Manual: Section 4.15</title><link rel="home" href="index.html">
<link rel="contents" href="Contents.html">
<link rel="index" href="DocIndex.html">
<link rel="summary" href="summary.html">
<link rel="previous" href="dynamic.html">
<link rel="next" href="IO.html">

<style type="text/css">

/* Style sheet for SWI-Prolog latex2html
*/

dd.defbody
{ margin-bottom: 1em;
}

dt.pubdef, dt.multidef
{ color: #fff;
padding: 2px 10px 0px 10px;
margin-bottom: 5px;
font-size: 18px;
vertical-align: middle;
overflow: hidden;
}

dt.pubdef { background-color: #0c3d6e; }
dt.multidef { background-color: #ef9439; }

.bib dd
{ margin-bottom: 1em;
}

.bib dt
{ float: left;
margin-right: 1.3ex;
}

pre.code
{ margin-left: 1.5em;
margin-right: 1.5em;
border: 1px dotted;
padding-top: 5px;
padding-left: 5px;
padding-bottom: 5px;
background-color: #f8f8f8;
}

div.navigate
{ text-align: center;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
}

div.title
{ text-align: center;
padding-bottom: 1em;
font-size: 200%;
font-weight: bold;
}

div.author
{ text-align: center;
font-style: italic;
}

div.abstract
{ margin-top: 2em;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
margin-left: 10%; margin-right:10%;
}

div.abstract-title
{ text-align: center;
padding: 5px;
font-size: 120%;
font-weight: bold;
}

div.toc-h1
{ font-size: 200%;
font-weight: bold;
}

div.toc-h2
{ font-size: 120%;
font-weight: bold;
margin-left: 2em;
}

div.toc-h3
{ font-size: 100%;
font-weight: bold;
margin-left: 4em;
}

div.toc-h4
{ font-size: 100%;
margin-left: 6em;
}

span.sec-nr
{
}

span.sec-title
{
}

span.pred-ext
{ font-weight: bold;
}

span.pred-tag
{ float: right;
padding-top: 0.2em;
font-size: 80%;
font-style: italic;
color: #fff;
}

div.caption
{ width: 80%;
margin: auto;
text-align:center;
}

/* Footnotes */
.fn {
color: red;
font-size: 70%;
}

.fn-text, .fnp {
position: absolute;
top: auto;
left: 10%;
border: 1px solid #000;
box-shadow: 5px 5px 5px #888;
display: none;
background: #fff;
color: #000;
margin-top: 25px;
padding: 8px 12px;
font-size: larger;
}

sup:hover span.fn-text
{ display: block;
}

/* Lists */

dl.latex
{ margin-top: 1ex;
margin-bottom: 0.5ex;
}

dl.latex dl.latex dd.defbody
{ margin-bottom: 0.5ex;
}

/* PlDoc Tags */

dl.tags
{ font-size: 90%;
margin-left: 5ex;
margin-top: 1ex;
margin-bottom: 0.5ex;
}

dl.tags dt
{ margin-left: 0pt;
font-weight: bold;
}

dl.tags dd
{ margin-left: 3ex;
}

td.param
{ font-style: italic;
font-weight: bold;
}

/* Index */

dt.index-sep
{ font-weight: bold;
font-size: +1;
margin-top: 1ex;
}

/* Tables */

table.center
{ margin: auto;
}

table.latex
{ border-collapse:collapse;
}

table.latex tr
{ vertical-align: text-top;
}

table.latex td,th
{ padding: 2px 1em;
}

table.latex tr.hline td,th
{ border-top: 1px solid black;
}

table.frame-box
{ border: 2px solid black;
}

</style>
</head>
<body style="background:white">
<div class="navigate"><a class="nav" href="index.html"><img src="home.gif" alt="Home"></a>
<a class="nav" href="Contents.html"><img src="index.gif" alt="Contents"></a>
<a class="nav" href="DocIndex.html"><img src="yellow_pages.gif" alt="Index"></a>
<a class="nav" href="summary.html"><img src="info.gif" alt="Summary"></a>
<a class="nav" href="dynamic.html"><img src="prev.gif" alt="Previous"></a>
<a class="nav" href="IO.html"><img src="next.gif" alt="Next"></a>
</div>
<h2 id="sec:examineprog"><a id="sec:4.15"><span class="sec-nr">4.15</span> <span class="sec-title">Examining 
the program</span></a></h2>

<a id="sec:examineprog"></a>

<dl class="latex">
<dt class="pubdef"><a id="current_atom/1"><strong>current_atom</strong>(<var>-Atom</var>)</a></dt>
<dd class="defbody">
Successively unifies <var>Atom</var> with all atoms known to the system. 
Note that <a id="idx:currentatom1:763"></a><a class="pred" href="examineprog.html#current_atom/1">current_atom/1</a> 
always succeeds if <var>Atom</var> is instantiated to an atom.</dd>
<dt class="pubdef"><a id="current_blob/2"><strong>current_blob</strong>(<var>?Blob, 
?Type</var>)</a></dt>
<dd class="defbody">
Examine the type or enumerate blobs of the given <var>Type</var>. Typed 
blobs are supported through the foreign language interface for storing 
arbitrary BLOBs (Binary Large Object) or handles to external entities. 
See <a class="sec" href="foreigninclude.html">section 9.4.7</a> for 
details.</dd>
<dt class="pubdef"><a id="current_functor/2"><strong>current_functor</strong>(<var>?Name, 
?Arity</var>)</a></dt>
<dd class="defbody">
Successively unifies <var>Name</var> with the name and <var>Arity</var> 
with the arity of functors known to the system.</dd>
<dt class="pubdef"><a id="current_flag/1"><strong>current_flag</strong>(<var>-FlagKey</var>)</a></dt>
<dd class="defbody">
Successively unifies <var>FlagKey</var> with all keys used for flags 
(see
<a id="idx:flag3:764"></a><a class="pred" href="db.html#flag/3">flag/3</a>).</dd>
<dt class="pubdef"><a id="current_key/1"><strong>current_key</strong>(<var>-Key</var>)</a></dt>
<dd class="defbody">
Successively unifies <var>Key</var> with all keys used for records (see
<a id="idx:recorda3:765"></a><a class="pred" href="db.html#recorda/3">recorda/3</a>, 
etc.).</dd>
<dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="current_predicate/1"><strong>current_predicate</strong>(<var>:PredicateIndicator</var>)</a></dt>
<dd class="defbody">
True if <var>PredicateIndicator</var> is a currently defined predicate. 
A predicate is considered defined if it exists in the specified module, 
is imported into the module or is defined in one of the modules from 
which the predicate will be imported if it is called (see
<a class="sec" href="importmodule.html">section 5.9</a>). Note that <a id="idx:currentpredicate1:766"></a><a class="pred" href="examineprog.html#current_predicate/1">current_predicate/1</a> 
does <em>not</em> succeed for predicates that can be <em>autoloaded</em>. 
See also
<a id="idx:currentpredicate2:767"></a><a class="pred" href="examineprog.html#current_predicate/2">current_predicate/2</a> 
and <a id="idx:predicateproperty2:768"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a>.

<p>If <var>PredicateIndicator</var> is not fully specified, the 
predicate only generates values that are defined in or already imported 
into the target module. Generating all callable predicates therefore 
requires enumerating modules using <a id="idx:currentmodule1:769"></a><a class="pred" href="manipmodule.html#current_module/1">current_module/1</a>. 
Generating predicates callable in a given module requires enumerating 
the import modules using <a id="idx:importmodule2:770"></a><a class="pred" href="importmodule.html#import_module/2">import_module/2</a> 
and the autoloadable predicates using the
<a id="idx:predicateproperty2:771"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a> <code>autoload</code>.</dd>
<dt class="pubdef"><a id="current_predicate/2"><strong>current_predicate</strong>(<var>?Name, 
:Head</var>)</a></dt>
<dd class="defbody">
Classical pre-ISO implementation of <a id="idx:currentpredicate1:772"></a><a class="pred" href="examineprog.html#current_predicate/1">current_predicate/1</a>, 
where the predicate is represented by the head term. The advantage is 
that this can be used for checking the existence of a predicate before 
calling it without the need for <a id="idx:functor3:773"></a><a class="pred" href="manipterm.html#functor/3">functor/3</a>:

<pre class="code">
call_if_exists(G) :-
        current_predicate(_, G),
        call(G).
</pre>

<p>Because of this intended usage, <a id="idx:currentpredicate2:774"></a><a class="pred" href="examineprog.html#current_predicate/2">current_predicate/2</a> 
also succeeds if the predicate can be autoloaded. Unfortunately, 
checking the autoloader makes this predicate relatively slow, in 
particular because a failed lookup of the autoloader will cause the 
autoloader to verify that its index is up-to-date.</dd>
<dt class="pubdef"><a id="predicate_property/2"><strong>predicate_property</strong>(<var>:Head, 
?Property</var>)</a></dt>
<dd class="defbody">
True when <var>Head</var> refers to a predicate that has property
<var>Property</var>. With sufficiently instantiated <var>Head</var>,
<a id="idx:predicateproperty2:775"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a> 
tries to resolve the predicate the same way as calling it would do: if 
the predicate is not defined it scans the default modules (see <a id="idx:defaultmodule2:776"></a><a class="pred" href="importmodule.html#default_module/2">default_module/2</a>) 
and finally tries the autoloader. Unlike calling, failure to find the 
target predicate causes
<a id="idx:predicateproperty2:777"></a><a class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</a> 
to fail silently. If <var>Head</var> is not sufficiently bound, only 
currently locally defined and already imported predicates are 
enumerated. See <a id="idx:currentpredicate1:778"></a><a class="pred" href="examineprog.html#current_predicate/1">current_predicate/1</a> 
for enumerating all predicates. A common issue concerns <em>generating</em> 
all built-in predicates. This can be achieved using the code below:

<pre class="code">
generate_built_in(Name/Arity) :-
    predicate_property(system:Head, built_in),
    functor(Head, Name, Arity),
    \+ sub_atom(Name, 0, _, _, $).   % discard reserved names
</pre>

<p><var>Property</var> is one of:

<dl class="latex">
<dt><strong>autoload</strong>(<var>File</var>)</dt>
<dd class="defbody">
True if the predicate can be autoloaded from the file <var>File</var>. 
Like <code>undefined</code>, this property is <em>not</em> generated.</dd>
<dt><strong>built_in</strong></dt>
<dd class="defbody">
True if the predicate is locked as a built-in predicate. This implies it 
cannot be redefined in its definition module and it can normally not be 
seen in the tracer.</dd>
<dt><strong>dynamic</strong></dt>
<dd class="defbody">
True if <a id="idx:assert1:779"></a><a class="pred" href="db.html#assert/1">assert/1</a> 
and <a id="idx:retract1:780"></a><a class="pred" href="db.html#retract/1">retract/1</a> 
may be used to modify the predicate. This property is set using <a id="idx:dynamic1:781"></a><a class="pred" href="dynamic.html#dynamic/1">dynamic/1</a>.</dd>
<dt><strong>exported</strong></dt>
<dd class="defbody">
True if the predicate is in the public list of the context module.
</dd>
<dt><strong>imported_from</strong>(<var>Module</var>)</dt>
<dd class="defbody">
Is true if the predicate is imported into the context module from module <var>Module</var>.</dd>
<dt><strong>file</strong>(<var>FileName</var>)</dt>
<dd class="defbody">
Unify <var>FileName</var> with the name of the source file in which the 
predicate is defined. See also <a id="idx:sourcefile2:782"></a><a class="pred" href="consulting.html#source_file/2">source_file/2</a> 
and the property
<code>line_count</code>. Note that this reports the file of the first 
clause of a predicate. A more robust interface can be achieved using <a id="idx:nthclause3:783"></a><a class="pred" href="examineprog.html#nth_clause/3">nth_clause/3</a> 
and <a id="idx:clauseproperty2:784"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>.</dd>
<dt><strong>foreign</strong></dt>
<dd class="defbody">
True if the predicate is defined in the C language.</dd>
<dt><strong>indexed</strong>(<var>Indexes</var>)</dt>
<dd class="defbody">
<var>Indexes</var><sup class="fn">59<span class="fn-text">This predicate 
property should be used for analysis and statistics only. The exact 
representation of <var>Indexes</var> may change between versions.</span></sup> 
is a list of additional (hash) indexes on the predicate. Each element of 
the list is a term
<var>ArgSpec</var>-<var>Index</var>. Currently <var>ArgSpec</var> is an 
integer denoting the argument position and <var>Index</var> is a term
<code>hash(Buckets, Speedup, IsList)</code>. Here <var>Buckets</var> is 
the number of buckets in the hash and <var>Speedup</var> is the expected 
speedup relative to trying all clauses linearly. <var>IsList</var> 
indicates that a list is created for all clauses with the same key. This 
is currently not used.</dd>
<dt><strong>interpreted</strong></dt>
<dd class="defbody">
True if the predicate is defined in Prolog. We return true on this 
because, although the code is actually compiled, it is completely 
transparent, just like interpreted code.</dd>
<dt><strong>iso</strong></dt>
<dd class="defbody">
True if the predicate is covered by the ISO standard (ISO/IEC 13211-1).</dd>
<dt><strong>line_count</strong>(<var>LineNumber</var>)</dt>
<dd class="defbody">
Unify <var>LineNumber</var> with the line number of the first clause of 
the predicate. Fails if the predicate is not associated with a file. See 
also <a id="idx:sourcefile2:785"></a><a class="pred" href="consulting.html#source_file/2">source_file/2</a>. 
See also the <code>file</code> property above, notably the reference to <a id="idx:clauseproperty2:786"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a>.</dd>
<dt><strong>multifile</strong></dt>
<dd class="defbody">
True if there may be multiple (or no) files providing clauses for the 
predicate. This property is set using <a id="idx:multifile1:787"></a><a class="pred" href="dynamic.html#multifile/1">multifile/1</a>.</dd>
<dt><strong>meta_predicate</strong>(<var>Head</var>)</dt>
<dd class="defbody">
If the predicate is declared as a meta-predicate using <a id="idx:metapredicate1:788"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a>, 
unify <var>Head</var> with the head-pattern. The head-pattern is a 
compound term with the same name and arity as the predicate where each 
argument of the term is a meta-predicate specifier. See <a id="idx:metapredicate1:789"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a> 
for details.</dd>
<dt><strong>nodebug</strong></dt>
<dd class="defbody">
Details of the predicate are not shown by the debugger. This is the 
default for built-in predicates. User predicates can be compiled this 
way using the Prolog flag <a class="flag" href="flags.html#flag:generate_debug_info">generate_debug_info</a>.</dd>
<dt><strong>notrace</strong></dt>
<dd class="defbody">
Do not show ports of this predicate in the debugger.</dd>
<dt><strong>number_of_clauses</strong>(<var>ClauseCount</var>)</dt>
<dd class="defbody">
Unify <var>ClauseCount</var> to the number of clauses associated with 
the predicate. Fails for foreign predicates.</dd>
<dt><strong>number_of_rules</strong>(<var>RuleCount</var>)</dt>
<dd class="defbody">
Unify <var>RuleCount</var> to the number of clauses associated with the 
predicate. A <em>rule</em> is defined as a clauses that has a body that 
is not just <code>true</code> (i.e., a <em>fact</em>). Fails for foreign 
predicates. This property is used to avoid analysing predicates with 
only facts in <code>library(prolog_codewalk)</code>.</dd>
<dt><strong>public</strong></dt>
<dd class="defbody">
Predicate is declared public using <a id="idx:public1:790"></a><a class="pred" href="dynamic.html#public/1">public/1</a>. 
Note that without further definition, public predicates are considered 
undefined and this property is <em>not</em> reported.</dd>
<dt><strong>quasi_quotation_syntax</strong>(<var>quasi_quotation_syntax</var>)</dt>
<dd class="defbody">
he predicate (with arity&nbsp;4) is declared to provide quasi quotation 
syntax with <a id="idx:quasiquotationsyntax1:791"></a><a class="pred" href="quasiquotations.html#quasi_quotation_syntax/1">quasi_quotation_syntax/1</a>.</dd>
<dt><strong>thread_local</strong></dt>
<dd class="defbody">
If true (only possible on the multithreaded version) each thread has its 
own clauses for the predicate. This property is set using
<a id="idx:threadlocal1:792"></a><a class="pred" href="threadcom.html#thread_local/1">thread_local/1</a>.</dd>
<dt><strong>transparent</strong></dt>
<dd class="defbody">
True if the predicate is declared transparent using the
<a id="idx:moduletransparent1:793"></a><a class="pred" href="ctxmodule.html#module_transparent/1">module_transparent/1</a> 
or <a id="idx:metapredicate1:794"></a><a class="pred" href="metapred.html#meta_predicate/1">meta_predicate/1</a> 
declaration. In the latter case the property <code>meta_predicate(Head)</code> 
is also provided. See <a class="sec" href="modules.html">chapter 5</a> 
for details.</dd>
<dt><strong>undefined</strong></dt>
<dd class="defbody">
True if a procedure definition block for the predicate exists, but there 
are no clauses for it and it is not declared dynamic or multifile. This 
is true if the predicate occurs in the body of a loaded predicate, an 
attempt to call it has been made via one of the meta-call predicates, or 
the predicate had a definition in the past. See the library package
<code>library(check)</code> for example usage.</dd>
<dt><strong>visible</strong></dt>
<dd class="defbody">
True when predicate can be called without raising a predicate existence 
error. This means that the predicate is (1) defined, (2) can be 
inherited from one of the default modules (see <a id="idx:defaultmodule2:795"></a><a class="pred" href="importmodule.html#default_module/2">default_module/2</a>) 
or (3) can be autoloaded. The behaviour is logically consistent iff the 
property
<code>visible</code> is provided explicitly. If the property is left 
unbound, only defined predicates are enumerated.</dd>
<dt><strong>volatile</strong></dt>
<dd class="defbody">
If true, the clauses are not saved into a saved state by <a id="idx:qsaveprogram12:796"></a><span class="pred-ext">qsave_program/[1,2]</span>. 
This property is set using <a id="idx:volatile1:797"></a><a class="pred" href="runtime.html#volatile/1">volatile/1</a>.
</dd>
</dl>

</dd>
<dt class="pubdef"><a id="dwim_predicate/2"><strong>dwim_predicate</strong>(<var>+Term, 
-Dwim</var>)</a></dt>
<dd class="defbody">
`Do What I Mean' (`dwim') support predicate. <var>Term</var> is a term, 
whose name and arity are used as a predicate specification. <var>Dwim</var> 
is instantiated with the most general term built from <var>Name</var> 
and the arity of a defined predicate that matches the predicate 
specified by
<var>Term</var> in the `Do What I Mean' sense. See <a id="idx:dwimmatch2:798"></a><a class="pred" href="miscpreds.html#dwim_match/2">dwim_match/2</a> 
for `Do What I Mean' string matching. Internal system predicates are not 
generated, unless the access level is <code>system</code> (see
<a class="flag" href="flags.html#flag:access_level">access_level</a>). 
Backtracking provides all alternative matches.</dd>
<dt class="pubdef"><span class="pred-tag">[ISO]</span><a id="clause/2"><strong>clause</strong>(<var>:Head, 
?Body</var>)</a></dt>
<dd class="defbody">
True if <var>Head</var> can be unified with a clause head and <var>Body</var> 
with the corresponding clause body. Gives alternative clauses on 
backtracking. For facts, <var>Body</var> is unified with the atom <var>true</var>.</dd>
<dt class="pubdef"><a id="clause/3"><strong>clause</strong>(<var>:Head, 
?Body, ?Reference</var>)</a></dt>
<dd class="defbody">
Equivalent to <a id="idx:clause2:799"></a><a class="pred" href="examineprog.html#clause/2">clause/2</a>, 
but unifies <var>Reference</var> with a unique reference to the clause 
(see also <a id="idx:assert2:800"></a><a class="pred" href="db.html#assert/2">assert/2</a>, <a id="idx:erase1:801"></a><a class="pred" href="db.html#erase/1">erase/1</a>). 
If <var>Reference</var> is instantiated to a reference the clause's head 
and body will be unified with <var>Head</var> and <var>Body</var>.</dd>
<dt class="pubdef"><a id="nth_clause/3"><strong>nth_clause</strong>(<var>?Pred, 
?Index, ?Reference</var>)</a></dt>
<dd class="defbody">
Provides access to the clauses of a predicate using their index number. 
Counting starts at 1. If <var>Reference</var> is specified it unifies <var>Pred</var> 
with the most general term with the same name/arity as the predicate and
<var>Index</var> with the index number of the clause. Otherwise the name 
and arity of <var>Pred</var> are used to determine the predicate. If <var>Index</var> 
is provided, <var>Reference</var> will be unified with the clause 
reference. If <var>Index</var> is unbound, backtracking will yield both 
the indexes and the references of all clauses of the predicate. The 
following example finds the 2nd clause of <a id="idx:append3:802"></a><a class="pred" href="lists.html#append/3">append/3</a>:

<pre class="code">
?- use_module(library(lists)).
...
?- nth_clause(append(_,_,_), 2, Ref), clause(Head, Body, Ref).
Ref = &lt;clause&gt;(0x994290),
Head = lists:append([_G23|_G24], _G21, [_G23|_G27]),
Body = append(_G24, _G21, _G27).
</pre>

</dd>
<dt class="pubdef"><a id="clause_property/2"><strong>clause_property</strong>(<var>+ClauseRef, 
-Property</var>)</a></dt>
<dd class="defbody">

<p>Queries properties of a clause. <var>ClauseRef</var> is a reference 
to a clause as produced by <a id="idx:clause3:803"></a><a class="pred" href="examineprog.html#clause/3">clause/3</a>, <a id="idx:nthclause3:804"></a><a class="pred" href="examineprog.html#nth_clause/3">nth_clause/3</a> 
or
<a id="idx:prologframeattribute3:805"></a><a class="pred" href="manipstack.html#prolog_frame_attribute/3">prolog_frame_attribute/3</a>. 
Unlike most other predicates that access clause references, <a id="idx:clauseproperty2:806"></a><a class="pred" href="examineprog.html#clause_property/2">clause_property/2</a> 
may be used to get information about erased clauses that have not yet 
been reclaimed. <var>Property</var> is one of the following:

<dl class="latex">
<dt><strong>file</strong>(<var>FileName</var>)</dt>
<dd class="defbody">
Unify <var>FileName</var> with the name of the file in which the clause 
textually appears. Fails if the clause is created by loading a file 
(e.g., clauses added using <a id="idx:assertz1:807"></a><a class="pred" href="db.html#assertz/1">assertz/1</a>). 
See also <code>source</code>.
</dd>
<dt><strong>line_count</strong>(<var>LineNumber</var>)</dt>
<dd class="defbody">
Unify <var>LineNumber</var> with the line number of the clause. Fails if 
the clause is not associated to a file.
</dd>
<dt><strong>source</strong>(<var>FileName</var>)</dt>
<dd class="defbody">
Unify <var>FileName</var> with the name of the source file that created 
the clause. This is the same as the <code>file</code> property, unless 
the file is loaded from a file that is textually included into source 
using
<a id="idx:include1:808"></a><a class="pred" href="consulting.html#include/1">include/1</a>. 
In this scenario, <code>file</code> is the included file, while the <code>source</code> 
property refers to the <em>main</em> file.
</dd>
<dt><strong>fact</strong></dt>
<dd class="defbody">
True if the clause has no body.
</dd>
<dt><strong>erased</strong></dt>
<dd class="defbody">
True if the clause has been erased, but not yet reclaimed because it is 
referenced.
</dd>
<dt><strong>predicate</strong>(<var>PredicateIndicator</var>)</dt>
<dd class="defbody">
<var>PredicateIndicator</var> denotes the predicate to which this clause 
belongs. This is needed to obtain information on erased clauses because 
the usual way to obtain this information using <a id="idx:clause3:809"></a><a class="pred" href="examineprog.html#clause/3">clause/3</a> 
fails for erased clauses.
</dd>
</dl>

</dd>
</dl>

<p></body></html>