porolog 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +18 -4
- data/bin/porolog +38 -2
- data/coverage/badge.svg +1 -1
- data/coverage/index.html +52327 -6692
- data/doc/Array.html +113 -33
- data/doc/Object.html +11 -17
- data/doc/Porolog.html +3681 -73
- data/doc/Symbol.html +17 -20
- data/doc/_index.html +181 -13
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +28 -38
- data/doc/index.html +28 -38
- data/doc/method_list.html +871 -167
- data/doc/top-level-namespace.html +2 -2
- data/lib/porolog.rb +1015 -2
- data/lib/porolog/arguments.rb +16 -14
- data/lib/porolog/core_ext.rb +6 -0
- data/lib/porolog/error.rb +6 -0
- data/lib/porolog/goal.rb +205 -68
- data/lib/porolog/instantiation.rb +300 -0
- data/lib/porolog/predicate.rb +33 -16
- data/lib/porolog/rule.rb +129 -2
- data/lib/porolog/scope.rb +3 -3
- data/lib/porolog/tail.rb +52 -0
- data/lib/porolog/value.rb +9 -12
- data/lib/porolog/variable.rb +307 -0
- data/test/porolog/arguments_test.rb +217 -135
- data/test/porolog/core_ext_test.rb +24 -17
- data/test/porolog/goal_test.rb +481 -74
- data/test/porolog/instantiation_test.rb +874 -0
- data/test/porolog/porolog_test.rb +2121 -13
- data/test/porolog/predicate_test.rb +1 -1
- data/test/porolog/rule_test.rb +395 -0
- data/test/porolog/scope_test.rb +0 -2
- data/test/porolog/tail_test.rb +127 -0
- data/test/porolog/value_test.rb +1 -1
- data/test/porolog/variable_test.rb +1625 -0
- data/test/test_helper.rb +78 -5
- metadata +12 -4
data/doc/Symbol.html
CHANGED
@@ -143,8 +143,7 @@
|
|
143
143
|
|
144
144
|
|
145
145
|
<span class="summary_desc"><div class='inline'>
|
146
|
-
<p>An Array with the Object being the head and the other Object being the
|
147
|
-
tail.</p>
|
146
|
+
<p>An Array with the Object being the head and the other Object being the tail.</p>
|
148
147
|
</div></span>
|
149
148
|
|
150
149
|
</li>
|
@@ -243,8 +242,7 @@ tail.
|
|
243
242
|
</h3><div class="docstring">
|
244
243
|
<div class="discussion">
|
245
244
|
|
246
|
-
<p>Returns an Array with the Object being the head and the other Object being
|
247
|
-
the tail.</p>
|
245
|
+
<p>Returns an Array with the Object being the head and the other Object being the tail.</p>
|
248
246
|
|
249
247
|
|
250
248
|
</div>
|
@@ -283,8 +281,7 @@ the tail.
|
|
283
281
|
|
284
282
|
—
|
285
283
|
<div class='inline'>
|
286
|
-
<p>an Array with the Object being the head and the other Object being the
|
287
|
-
tail.</p>
|
284
|
+
<p>an Array with the Object being the head and the other Object being the tail.</p>
|
288
285
|
</div>
|
289
286
|
|
290
287
|
</li>
|
@@ -297,12 +294,12 @@ tail.
|
|
297
294
|
<pre class="lines">
|
298
295
|
|
299
296
|
|
300
|
-
75
|
301
297
|
76
|
302
|
-
77
|
298
|
+
77
|
299
|
+
78</pre>
|
303
300
|
</td>
|
304
301
|
<td>
|
305
|
-
<pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line
|
302
|
+
<pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line 76</span>
|
306
303
|
|
307
304
|
<span class='kw'>def</span> <span class='op'>/</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
308
305
|
<span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span><span class='op'>/</span><span class='id identifier rubyid_other'>other</span>
|
@@ -356,12 +353,12 @@ tail.
|
|
356
353
|
<pre class="lines">
|
357
354
|
|
358
355
|
|
359
|
-
59
|
360
356
|
60
|
361
|
-
61
|
357
|
+
61
|
358
|
+
62</pre>
|
362
359
|
</td>
|
363
360
|
<td>
|
364
|
-
<pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line
|
361
|
+
<pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line 60</span>
|
365
362
|
|
366
363
|
<span class='kw'>def</span> <span class='id identifier rubyid_myid'>myid</span>
|
367
364
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span>
|
@@ -415,12 +412,12 @@ tail.
|
|
415
412
|
<pre class="lines">
|
416
413
|
|
417
414
|
|
418
|
-
69
|
419
415
|
70
|
420
|
-
71
|
416
|
+
71
|
417
|
+
72</pre>
|
421
418
|
</td>
|
422
419
|
<td>
|
423
|
-
<pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line
|
420
|
+
<pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line 70</span>
|
424
421
|
|
425
422
|
<span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
|
426
423
|
<span class='symbol'>:variable</span>
|
@@ -474,12 +471,12 @@ tail.
|
|
474
471
|
<pre class="lines">
|
475
472
|
|
476
473
|
|
477
|
-
64
|
478
474
|
65
|
479
|
-
66
|
475
|
+
66
|
476
|
+
67</pre>
|
480
477
|
</td>
|
481
478
|
<td>
|
482
|
-
<pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line
|
479
|
+
<pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line 65</span>
|
483
480
|
|
484
481
|
<span class='kw'>def</span> <span class='id identifier rubyid_variables'>variables</span>
|
485
482
|
<span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span>
|
@@ -494,9 +491,9 @@ tail.
|
|
494
491
|
</div>
|
495
492
|
|
496
493
|
<div id="footer">
|
497
|
-
Generated on
|
494
|
+
Generated on Mon Jul 6 22:54:46 2020 by
|
498
495
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
499
|
-
0.9.19 (ruby-2.
|
496
|
+
0.9.19 (ruby-2.6.5).
|
500
497
|
</div>
|
501
498
|
|
502
499
|
</div>
|
data/doc/_index.html
CHANGED
@@ -107,6 +107,70 @@
|
|
107
107
|
|
108
108
|
</li>
|
109
109
|
|
110
|
+
<li>
|
111
|
+
<span class='object_link'><a href="Porolog/Rule/DefinitionError.html" title="Porolog::Rule::DefinitionError (class)">DefinitionError</a></span>
|
112
|
+
|
113
|
+
<small>(Porolog::Rule)</small>
|
114
|
+
|
115
|
+
</li>
|
116
|
+
|
117
|
+
</ul>
|
118
|
+
</ul>
|
119
|
+
|
120
|
+
|
121
|
+
<ul id="alpha_E" class="alpha">
|
122
|
+
<li class="letter">E</li>
|
123
|
+
<ul>
|
124
|
+
|
125
|
+
<li>
|
126
|
+
<span class='object_link'><a href="Porolog/Instantiation/Error.html" title="Porolog::Instantiation::Error (class)">Error</a></span>
|
127
|
+
|
128
|
+
<small>(Porolog::Instantiation)</small>
|
129
|
+
|
130
|
+
</li>
|
131
|
+
|
132
|
+
<li>
|
133
|
+
<span class='object_link'><a href="Porolog/Scope/Error.html" title="Porolog::Scope::Error (class)">Error</a></span>
|
134
|
+
|
135
|
+
<small>(Porolog::Scope)</small>
|
136
|
+
|
137
|
+
</li>
|
138
|
+
|
139
|
+
<li>
|
140
|
+
<span class='object_link'><a href="Porolog/Goal/Error.html" title="Porolog::Goal::Error (class)">Error</a></span>
|
141
|
+
|
142
|
+
<small>(Porolog::Goal)</small>
|
143
|
+
|
144
|
+
</li>
|
145
|
+
|
146
|
+
<li>
|
147
|
+
<span class='object_link'><a href="Porolog/Variable/Error.html" title="Porolog::Variable::Error (class)">Error</a></span>
|
148
|
+
|
149
|
+
<small>(Porolog::Variable)</small>
|
150
|
+
|
151
|
+
</li>
|
152
|
+
|
153
|
+
<li>
|
154
|
+
<span class='object_link'><a href="Porolog/Rule/Error.html" title="Porolog::Rule::Error (class)">Error</a></span>
|
155
|
+
|
156
|
+
<small>(Porolog::Rule)</small>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
<li>
|
161
|
+
<span class='object_link'><a href="Porolog/Value/Error.html" title="Porolog::Value::Error (class)">Error</a></span>
|
162
|
+
|
163
|
+
<small>(Porolog::Value)</small>
|
164
|
+
|
165
|
+
</li>
|
166
|
+
|
167
|
+
<li>
|
168
|
+
<span class='object_link'><a href="Porolog/Predicate/Error.html" title="Porolog::Predicate::Error (class)">Error</a></span>
|
169
|
+
|
170
|
+
<small>(Porolog::Predicate)</small>
|
171
|
+
|
172
|
+
</li>
|
173
|
+
|
110
174
|
</ul>
|
111
175
|
</ul>
|
112
176
|
|
@@ -137,6 +201,13 @@
|
|
137
201
|
|
138
202
|
</li>
|
139
203
|
|
204
|
+
<li>
|
205
|
+
<span class='object_link'><a href="Porolog/Variable/GoalError.html" title="Porolog::Variable::GoalError (class)">GoalError</a></span>
|
206
|
+
|
207
|
+
<small>(Porolog::Variable)</small>
|
208
|
+
|
209
|
+
</li>
|
210
|
+
|
140
211
|
<li>
|
141
212
|
<span class='object_link'><a href="Porolog/Value/GoalError.html" title="Porolog::Value::GoalError (class)">GoalError</a></span>
|
142
213
|
|
@@ -144,10 +215,33 @@
|
|
144
215
|
|
145
216
|
</li>
|
146
217
|
|
218
|
+
</ul>
|
219
|
+
</ul>
|
220
|
+
|
221
|
+
|
222
|
+
<ul id="alpha_I" class="alpha">
|
223
|
+
<li class="letter">I</li>
|
224
|
+
<ul>
|
225
|
+
|
147
226
|
<li>
|
148
|
-
<span class='object_link'><a href="Porolog/
|
227
|
+
<span class='object_link'><a href="Porolog/Instantiation.html" title="Porolog::Instantiation (class)">Instantiation</a></span>
|
149
228
|
|
150
|
-
<small>(Porolog
|
229
|
+
<small>(Porolog)</small>
|
230
|
+
|
231
|
+
</li>
|
232
|
+
|
233
|
+
</ul>
|
234
|
+
</ul>
|
235
|
+
|
236
|
+
|
237
|
+
<ul id="alpha_M" class="alpha">
|
238
|
+
<li class="letter">M</li>
|
239
|
+
<ul>
|
240
|
+
|
241
|
+
<li>
|
242
|
+
<span class='object_link'><a href="Porolog/Variable/MultipleValuesError.html" title="Porolog::Variable::MultipleValuesError (class)">MultipleValuesError</a></span>
|
243
|
+
|
244
|
+
<small>(Porolog::Variable)</small>
|
151
245
|
|
152
246
|
</li>
|
153
247
|
|
@@ -166,6 +260,20 @@
|
|
166
260
|
|
167
261
|
</li>
|
168
262
|
|
263
|
+
<li>
|
264
|
+
<span class='object_link'><a href="Porolog/NoGoalError.html" title="Porolog::NoGoalError (class)">NoGoalError</a></span>
|
265
|
+
|
266
|
+
<small>(Porolog)</small>
|
267
|
+
|
268
|
+
</li>
|
269
|
+
|
270
|
+
<li>
|
271
|
+
<span class='object_link'><a href="Porolog/Instantiation/NoVariableError.html" title="Porolog::Instantiation::NoVariableError (class)">NoVariableError</a></span>
|
272
|
+
|
273
|
+
<small>(Porolog::Instantiation)</small>
|
274
|
+
|
275
|
+
</li>
|
276
|
+
|
169
277
|
<li>
|
170
278
|
<span class='object_link'><a href="Porolog/Scope/NotPredicateError.html" title="Porolog::Scope::NotPredicateError (class)">NotPredicateError</a></span>
|
171
279
|
|
@@ -184,6 +292,9 @@
|
|
184
292
|
</ul>
|
185
293
|
|
186
294
|
|
295
|
+
</td><td valign='top' width="33%">
|
296
|
+
|
297
|
+
|
187
298
|
<ul id="alpha_O" class="alpha">
|
188
299
|
<li class="letter">O</li>
|
189
300
|
<ul>
|
@@ -220,13 +331,6 @@
|
|
220
331
|
|
221
332
|
</li>
|
222
333
|
|
223
|
-
<li>
|
224
|
-
<span class='object_link'><a href="Porolog/Predicate/PredicateError.html" title="Porolog::Predicate::PredicateError (class)">PredicateError</a></span>
|
225
|
-
|
226
|
-
<small>(Porolog::Predicate)</small>
|
227
|
-
|
228
|
-
</li>
|
229
|
-
|
230
334
|
</ul>
|
231
335
|
</ul>
|
232
336
|
|
@@ -261,9 +365,73 @@
|
|
261
365
|
</li>
|
262
366
|
|
263
367
|
<li>
|
264
|
-
<span class='object_link'><a href="Porolog/
|
368
|
+
<span class='object_link'><a href="Porolog/Variable/SelfReferentialError.html" title="Porolog::Variable::SelfReferentialError (class)">SelfReferentialError</a></span>
|
265
369
|
|
266
|
-
<small>(Porolog::
|
370
|
+
<small>(Porolog::Variable)</small>
|
371
|
+
|
372
|
+
</li>
|
373
|
+
|
374
|
+
<li>
|
375
|
+
<span class='object_link'><a href="Symbol.html" title="Symbol (class)">Symbol</a></span>
|
376
|
+
|
377
|
+
</li>
|
378
|
+
|
379
|
+
</ul>
|
380
|
+
</ul>
|
381
|
+
|
382
|
+
|
383
|
+
<ul id="alpha_T" class="alpha">
|
384
|
+
<li class="letter">T</li>
|
385
|
+
<ul>
|
386
|
+
|
387
|
+
<li>
|
388
|
+
<span class='object_link'><a href="Porolog/Tail.html" title="Porolog::Tail (class)">Tail</a></span>
|
389
|
+
|
390
|
+
<small>(Porolog)</small>
|
391
|
+
|
392
|
+
</li>
|
393
|
+
|
394
|
+
</ul>
|
395
|
+
</ul>
|
396
|
+
|
397
|
+
|
398
|
+
<ul id="alpha_U" class="alpha">
|
399
|
+
<li class="letter">U</li>
|
400
|
+
<ul>
|
401
|
+
|
402
|
+
<li>
|
403
|
+
<span class='object_link'><a href="Porolog/Variable/UnexpectedError.html" title="Porolog::Variable::UnexpectedError (class)">UnexpectedError</a></span>
|
404
|
+
|
405
|
+
<small>(Porolog::Variable)</small>
|
406
|
+
|
407
|
+
</li>
|
408
|
+
|
409
|
+
<li>
|
410
|
+
<span class='object_link'><a href="Porolog/Instantiation/UnhandledIndexError.html" title="Porolog::Instantiation::UnhandledIndexError (class)">UnhandledIndexError</a></span>
|
411
|
+
|
412
|
+
<small>(Porolog::Instantiation)</small>
|
413
|
+
|
414
|
+
</li>
|
415
|
+
|
416
|
+
</ul>
|
417
|
+
</ul>
|
418
|
+
|
419
|
+
|
420
|
+
<ul id="alpha_V" class="alpha">
|
421
|
+
<li class="letter">V</li>
|
422
|
+
<ul>
|
423
|
+
|
424
|
+
<li>
|
425
|
+
<span class='object_link'><a href="Porolog/Value.html" title="Porolog::Value (class)">Value</a></span>
|
426
|
+
|
427
|
+
<small>(Porolog)</small>
|
428
|
+
|
429
|
+
</li>
|
430
|
+
|
431
|
+
<li>
|
432
|
+
<span class='object_link'><a href="Porolog/Variable.html" title="Porolog::Variable (class)">Variable</a></span>
|
433
|
+
|
434
|
+
<small>(Porolog)</small>
|
267
435
|
|
268
436
|
</li>
|
269
437
|
|
@@ -299,9 +467,9 @@
|
|
299
467
|
</div>
|
300
468
|
|
301
469
|
<div id="footer">
|
302
|
-
Generated on
|
470
|
+
Generated on Mon Jul 6 22:54:45 2020 by
|
303
471
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
304
|
-
0.9.19 (ruby-2.
|
472
|
+
0.9.19 (ruby-2.6.5).
|
305
473
|
</div>
|
306
474
|
|
307
475
|
</div>
|
data/doc/class_list.html
CHANGED
@@ -43,7 +43,7 @@
|
|
43
43
|
|
44
44
|
<ul id="full_list" class="class">
|
45
45
|
<li id="object_" class="odd"><div class="item" style="padding-left:30px"><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></div></li>
|
46
|
-
Array < ObjectTop Level Namespace Object < BasicObjectTop Level Namespace PorologTop Level Namespace
Symbol < ObjectTop Level Namespace |
46
|
+
Array < ObjectTop Level Namespace Object < BasicObjectTop Level Namespace PorologTop Level Namespace
Symbol < ObjectTop Level Namespace |
47
47
|
|
48
48
|
</ul>
|
49
49
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -60,38 +60,21 @@
|
|
60
60
|
<div id="content"><div id='filecontents'>
|
61
61
|
<h1 id="label-porolog">porolog</h1>
|
62
62
|
|
63
|
-
<p><img src=“<a
|
64
|
-
href="https://repository-images.githubusercontent.com/131847563/b3754100-636a-11e9-995b-20d409b992c9">repository-images.githubusercontent.com/131847563/b3754100-636a-11e9-995b-20d409b992c9</a>”
|
65
|
-
width=“240” height=“120” align=“right” /></p>
|
63
|
+
<p><img src=“<a href="https://repository-images.githubusercontent.com/131847563/b3754100-636a-11e9-995b-20d409b992c9">repository-images.githubusercontent.com/131847563/b3754100-636a-11e9-995b-20d409b992c9</a>” width=“240” height=“120” align=“right” /></p>
|
66
64
|
|
67
65
|
<p>Plain Old Ruby Objects Prolog (WORK IN PROGRESS)</p>
|
68
66
|
|
69
|
-
<p><a href="https://badge.fury.io/rb/porolog"><img
|
70
|
-
src="https://badge.fury.io/rb/porolog.svg"></a> <a
|
71
|
-
href="https://travis-ci.com/wizardofosmium/porolog"><img
|
72
|
-
src="https://travis-ci.com/wizardofosmium/porolog.svg?branch=master"></a>
|
73
|
-
<img
|
74
|
-
src="https://img.shields.io/badge/status-work%20in%20progress-orange.svg">
|
75
|
-
<a href="https://github.com/wizardofosmium/porolog"><img
|
76
|
-
src="https://github.com/wizardofosmium/porolog/blob/master/coverage/badge.svg"></a></p>
|
67
|
+
<p><a href="https://badge.fury.io/rb/porolog"><img src="https://badge.fury.io/rb/porolog.svg"></a> <a href="https://travis-ci.com/wizardofosmium/porolog"><img src="https://travis-ci.com/wizardofosmium/porolog.svg?branch=master"></a> <img src="https://img.shields.io/badge/status-work%20in%20progress-orange.svg"> <a href="https://github.com/wizardofosmium/porolog"><img src="https://github.com/wizardofosmium/porolog/blob/master/coverage/badge.svg"></a></p>
|
77
68
|
|
78
69
|
<h2 id="label-Introduction">Introduction</h2>
|
79
70
|
|
80
|
-
<p><code>porolog</code> is a Prolog implementation using plain old Ruby
|
81
|
-
objects with the aim that logic queries can be called within a regular Ruby
|
82
|
-
program. The goal was not to implement a Prolog interpreter that is just
|
83
|
-
implement in Ruby, but rather that a logic engine could be embedded in a
|
84
|
-
larger program.</p>
|
71
|
+
<p><code>porolog</code> is a Prolog implementation using plain old Ruby objects with the aim that logic queries can be called within a regular Ruby program. The goal was not to implement a Prolog interpreter that is just implement in Ruby, but rather that a logic engine could be embedded in a larger program.</p>
|
85
72
|
|
86
|
-
<p>The need that this gem aims to meet is to have a Ruby program interact with
|
87
|
-
a Prolog program using native Ruby objects (POROs); hence the name Porolog.
|
88
|
-
The goal was to implement a minimal logic engine in the style of Prolog
|
89
|
-
where Ruby objects could be passed in and Ruby objects were passed back.</p>
|
73
|
+
<p>The need that this gem aims to meet is to have a Ruby program interact with a Prolog program using native Ruby objects (POROs); hence the name Porolog. The goal was to implement a minimal logic engine in the style of Prolog where Ruby objects could be passed in and Ruby objects were passed back.</p>
|
90
74
|
|
91
75
|
<h2 id="label-Dependencies">Dependencies</h2>
|
92
76
|
|
93
|
-
<p>The aim of <code>porolog</code> is to provide a logic engine with a minimal
|
94
|
-
footprint. The only extra dependency is Yard for documentation.</p>
|
77
|
+
<p>The aim of <code>porolog</code> is to provide a logic engine with a minimal footprint. The only extra dependency is Yard for documentation.</p>
|
95
78
|
|
96
79
|
<h2 id="label-Installation">Installation</h2>
|
97
80
|
|
@@ -109,13 +92,11 @@ footprint. The only extra dependency is Yard for documentation.
|
|
109
92
|
<p>solving goals</p>
|
110
93
|
</li></ul>
|
111
94
|
|
112
|
-
<p>It is entirely possible to create a Ruby program that is effectively just a
|
113
|
-
Prolog program.</p>
|
95
|
+
<p>It is entirely possible to create a Ruby program that is effectively just a Prolog program.</p>
|
114
96
|
|
115
97
|
<h3 id="label-Basic+Usage">Basic Usage</h3>
|
116
98
|
|
117
|
-
<p>Using <code>porolog</code> involves creating logic from facts and rules. An
|
118
|
-
example, of the most basic usage uses just facts.</p>
|
99
|
+
<p>Using <code>porolog</code> involves creating logic from facts and rules. An example, of the most basic usage uses just facts.</p>
|
119
100
|
|
120
101
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>porolog</span><span class='tstring_end'>'</span></span>
|
121
102
|
|
@@ -135,15 +116,15 @@ example, of the most basic usage uses just facts.
|
|
135
116
|
|
136
117
|
<h3 id="label-Common+Usage">Common Usage</h3>
|
137
118
|
|
138
|
-
<p>Common usage is expected to be including Porolog in a class and
|
139
|
-
encapsulating the engine defined.</p>
|
119
|
+
<p>Common usage is expected to be including Porolog in a class and encapsulating the engine defined.</p>
|
140
120
|
|
141
121
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>porolog</span><span class='tstring_end'>'</span></span>
|
142
122
|
|
143
|
-
<span class='
|
123
|
+
<span class='id identifier rubyid_include'>include</span> <span class='const'><span class='object_link'><a href="Porolog.html" title="Porolog (module)">Porolog</a></span></span>
|
144
124
|
|
145
|
-
|
125
|
+
<span class='kw'>class</span> <span class='const'>Numbers</span>
|
146
126
|
|
127
|
+
<span class='const'>Predicate</span><span class='period'>.</span><span class='id identifier rubyid_scope'>scope</span> <span class='kw'>self</span>
|
147
128
|
<span class='id identifier rubyid_predicate'>predicate</span> <span class='symbol'>:prime</span>
|
148
129
|
|
149
130
|
<span class='id identifier rubyid_prime'>prime</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_fact!'>fact!</span>
|
@@ -164,16 +145,18 @@ encapsulating the engine defined.
|
|
164
145
|
<span class='kw'>end</span>
|
165
146
|
|
166
147
|
<span class='kw'>end</span>
|
148
|
+
|
149
|
+
|
150
|
+
<span class='id identifier rubyid_numbers'>numbers</span> <span class='op'>=</span> <span class='const'>Numbers</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
151
|
+
<span class='id identifier rubyid_numbers'>numbers</span><span class='period'>.</span><span class='id identifier rubyid_show_primes'>show_primes</span>
|
152
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_numbers'>numbers</span><span class='period'>.</span><span class='id identifier rubyid_primes'>primes</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span>
|
167
153
|
</code></pre>
|
168
154
|
|
169
155
|
<h3 id="label-Scope+and+Predicate+Usage">Scope and Predicate Usage</h3>
|
170
156
|
|
171
|
-
<p>A Predicate represents a Prolog predicate. They form the basis for rules
|
172
|
-
and queries.</p>
|
157
|
+
<p>A Predicate represents a Prolog predicate. They form the basis for rules and queries.</p>
|
173
158
|
|
174
|
-
<p>The Scope class enables you to have multiple logic programs embedded in the
|
175
|
-
same Ruby program. A Scope object defines a scope for the predicates of a
|
176
|
-
logic programme.</p>
|
159
|
+
<p>The Scope class enables you to have multiple logic programs embedded in the same Ruby program. A Scope object defines a scope for the predicates of a logic programme.</p>
|
177
160
|
|
178
161
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>porolog</span><span class='tstring_end'>'</span></span>
|
179
162
|
|
@@ -229,10 +212,17 @@ logic programme.
|
|
229
212
|
|
230
213
|
<p>or</p>
|
231
214
|
|
232
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_rake'>rake</span> <span class='id identifier
|
215
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_rake'>rake</span> <span class='id identifier rubyid_core_ext_test'>core_ext_test</span>
|
216
|
+
<span class='id identifier rubyid_rake'>rake</span> <span class='id identifier rubyid_porolog_test'>porolog_test</span>
|
217
|
+
<span class='id identifier rubyid_rake'>rake</span> <span class='id identifier rubyid_scope_test'>scope_test</span>
|
233
218
|
<span class='id identifier rubyid_rake'>rake</span> <span class='id identifier rubyid_predicate_test'>predicate_test</span>
|
234
219
|
<span class='id identifier rubyid_rake'>rake</span> <span class='id identifier rubyid_arguments_test'>arguments_test</span>
|
235
220
|
<span class='id identifier rubyid_rake'>rake</span> <span class='id identifier rubyid_rule_test'>rule_test</span>
|
221
|
+
<span class='id identifier rubyid_rake'>rake</span> <span class='id identifier rubyid_goal_test'>goal_test</span>
|
222
|
+
<span class='id identifier rubyid_rake'>rake</span> <span class='id identifier rubyid_variable_test'>variable_test</span>
|
223
|
+
<span class='id identifier rubyid_rake'>rake</span> <span class='id identifier rubyid_value_test'>value_test</span>
|
224
|
+
<span class='id identifier rubyid_rake'>rake</span> <span class='id identifier rubyid_tail_test'>tail_test</span>
|
225
|
+
<span class='id identifier rubyid_rake'>rake</span> <span class='id identifier rubyid_instantiation_test'>instantiation_test</span>
|
236
226
|
</code></pre>
|
237
227
|
|
238
228
|
<h2 id="label-Author">Author</h2>
|
@@ -241,9 +231,9 @@ logic programme.
|
|
241
231
|
</div></div>
|
242
232
|
|
243
233
|
<div id="footer">
|
244
|
-
Generated on
|
234
|
+
Generated on Mon Jul 6 22:54:45 2020 by
|
245
235
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
246
|
-
0.9.19 (ruby-2.
|
236
|
+
0.9.19 (ruby-2.6.5).
|
247
237
|
</div>
|
248
238
|
|
249
239
|
</div>
|