porolog 0.0.4 → 1.0.0

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -5
  3. data/Rakefile +7 -2
  4. data/bin/porolog +58 -1
  5. data/coverage/badge.svg +1 -1
  6. data/coverage/index.html +76733 -2638
  7. data/doc/Array.html +1066 -0
  8. data/doc/Object.html +674 -0
  9. data/doc/Porolog.html +4153 -74
  10. data/doc/Symbol.html +501 -0
  11. data/doc/_index.html +280 -6
  12. data/doc/class_list.html +1 -1
  13. data/doc/file.README.html +34 -39
  14. data/doc/index.html +34 -39
  15. data/doc/method_list.html +1337 -57
  16. data/doc/top-level-namespace.html +4 -2
  17. data/lib/porolog.rb +1144 -4
  18. data/lib/porolog/arguments.rb +28 -24
  19. data/lib/porolog/core_ext.rb +188 -0
  20. data/lib/porolog/error.rb +9 -0
  21. data/lib/porolog/goal.rb +357 -0
  22. data/lib/porolog/instantiation.rb +346 -0
  23. data/lib/porolog/predicate.rb +74 -31
  24. data/lib/porolog/predicate/builtin.rb +825 -0
  25. data/lib/porolog/rule.rb +162 -0
  26. data/lib/porolog/scope.rb +4 -4
  27. data/lib/porolog/tail.rb +57 -0
  28. data/lib/porolog/value.rb +105 -0
  29. data/lib/porolog/variable.rb +325 -0
  30. data/test/porolog/arguments_test.rb +244 -195
  31. data/test/porolog/core_ext_test.rb +290 -0
  32. data/test/porolog/goal_test.rb +891 -0
  33. data/test/porolog/instantiation_test.rb +910 -0
  34. data/test/porolog/porolog_test.rb +2376 -13
  35. data/test/porolog/predicate/builtin_test.rb +1340 -0
  36. data/test/porolog/predicate_test.rb +84 -30
  37. data/test/porolog/rule_test.rb +527 -0
  38. data/test/porolog/scope_test.rb +0 -2
  39. data/test/porolog/tail_test.rb +127 -0
  40. data/test/porolog/value_test.rb +315 -0
  41. data/test/porolog/variable_test.rb +1614 -0
  42. data/test/samples_test.rb +277 -0
  43. data/test/test_helper.rb +115 -0
  44. metadata +34 -7
@@ -0,0 +1,674 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Object
8
+
9
+ &mdash; Documentation by YARD 0.9.19
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Object";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index (O)</a> &raquo;
40
+
41
+
42
+ <span class="title">Object</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Object
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">BasicObject</span>
73
+
74
+ </dd>
75
+ </dl>
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+ <dl>
88
+ <dt>Defined in:</dt>
89
+ <dd>lib/porolog/core_ext.rb</dd>
90
+ </dl>
91
+
92
+ </div>
93
+
94
+ <h2>Overview</h2><div class="docstring">
95
+ <div class="discussion">
96
+
97
+ <p>In Porolog, Objects represent atomic values.</p>
98
+
99
+
100
+ </div>
101
+ </div>
102
+ <div class="tags">
103
+
104
+
105
+ </div>
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+ <h2>
114
+ Instance Method Summary
115
+ <small><a href="#" class="summary_toggle">collapse</a></small>
116
+ </h2>
117
+
118
+ <ul class="summary">
119
+
120
+ <li class="public ">
121
+ <span class="summary_signature">
122
+
123
+ <a href="#headtail%3F-instance_method" title="#headtail? (instance method)">#<strong>headtail?</strong> &#x21d2; Boolean </a>
124
+
125
+
126
+
127
+ </span>
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+ <span class="summary_desc"><div class='inline'>
138
+ <p>Whether the Object is an Array with a head and a tail (for an Object, should be false).</p>
139
+ </div></span>
140
+
141
+ </li>
142
+
143
+
144
+ <li class="public ">
145
+ <span class="summary_signature">
146
+
147
+ <a href="#myid-instance_method" title="#myid (instance method)">#<strong>myid</strong> &#x21d2; String </a>
148
+
149
+
150
+
151
+ </span>
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+ <span class="summary_desc"><div class='inline'>
162
+ <p>A convenience method for testing/debugging.</p>
163
+ </div></span>
164
+
165
+ </li>
166
+
167
+
168
+ <li class="public ">
169
+ <span class="summary_signature">
170
+
171
+ <a href="#tail-instance_method" title="#tail (instance method)">#<strong>tail</strong>(other) &#x21d2; Array </a>
172
+
173
+
174
+
175
+ (also: #/)
176
+
177
+ </span>
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+ <span class="summary_desc"><div class='inline'>
188
+ <p>An Array with the Object being the head and the other Object being the tail.</p>
189
+ </div></span>
190
+
191
+ </li>
192
+
193
+
194
+ <li class="public ">
195
+ <span class="summary_signature">
196
+
197
+ <a href="#type-instance_method" title="#type (instance method)">#<strong>type</strong> &#x21d2; Symbol </a>
198
+
199
+
200
+
201
+ </span>
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+ <span class="summary_desc"><div class='inline'>
212
+ <p>The type of the object (for an Object, should be :atomic).</p>
213
+ </div></span>
214
+
215
+ </li>
216
+
217
+
218
+ <li class="public ">
219
+ <span class="summary_signature">
220
+
221
+ <a href="#value-instance_method" title="#value (instance method)">#<strong>value</strong> &#x21d2; Object </a>
222
+
223
+
224
+
225
+ </span>
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+ <span class="summary_desc"><div class='inline'>
236
+ <p>The value of the object, which is itself.</p>
237
+ </div></span>
238
+
239
+ </li>
240
+
241
+
242
+ <li class="public ">
243
+ <span class="summary_signature">
244
+
245
+ <a href="#variables-instance_method" title="#variables (instance method)">#<strong>variables</strong> &#x21d2; Array </a>
246
+
247
+
248
+
249
+ </span>
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+ <span class="summary_desc"><div class='inline'>
260
+ <p>Embedded variables (for an Object, should be none).</p>
261
+ </div></span>
262
+
263
+ </li>
264
+
265
+
266
+ </ul>
267
+
268
+
269
+
270
+
271
+ <div id="instance_method_details" class="method_details_list">
272
+ <h2>Instance Method Details</h2>
273
+
274
+
275
+ <div class="method_details first">
276
+ <h3 class="signature first" id="headtail?-instance_method">
277
+
278
+ #<strong>headtail?</strong> &#x21d2; <tt>Boolean</tt>
279
+
280
+
281
+
282
+
283
+
284
+ </h3><div class="docstring">
285
+ <div class="discussion">
286
+
287
+ <p>Returns whether the Object is an Array with a head and a tail (for an Object, should be false).</p>
288
+
289
+
290
+ </div>
291
+ </div>
292
+ <div class="tags">
293
+
294
+ <p class="tag_title">Returns:</p>
295
+ <ul class="return">
296
+
297
+ <li>
298
+
299
+
300
+ <span class='type'>(<tt>Boolean</tt>)</span>
301
+
302
+
303
+
304
+ &mdash;
305
+ <div class='inline'>
306
+ <p>whether the Object is an Array with a head and a tail (for an Object, should be false).</p>
307
+ </div>
308
+
309
+ </li>
310
+
311
+ </ul>
312
+
313
+ </div><table class="source_code">
314
+ <tr>
315
+ <td>
316
+ <pre class="lines">
317
+
318
+
319
+ 48
320
+ 49
321
+ 50</pre>
322
+ </td>
323
+ <td>
324
+ <pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line 48</span>
325
+
326
+ <span class='kw'>def</span> <span class='id identifier rubyid_headtail?'>headtail?</span>
327
+ <span class='kw'>false</span>
328
+ <span class='kw'>end</span></pre>
329
+ </td>
330
+ </tr>
331
+ </table>
332
+ </div>
333
+
334
+ <div class="method_details ">
335
+ <h3 class="signature " id="myid-instance_method">
336
+
337
+ #<strong>myid</strong> &#x21d2; <tt>String</tt>
338
+
339
+
340
+
341
+
342
+
343
+ </h3><div class="docstring">
344
+ <div class="discussion">
345
+
346
+ <p>A convenience method for testing/debugging.</p>
347
+
348
+
349
+ </div>
350
+ </div>
351
+ <div class="tags">
352
+
353
+ <p class="tag_title">Returns:</p>
354
+ <ul class="return">
355
+
356
+ <li>
357
+
358
+
359
+ <span class='type'>(<tt>String</tt>)</span>
360
+
361
+
362
+
363
+ &mdash;
364
+ <div class='inline'>
365
+ <p>the equivalent of inspect.</p>
366
+ </div>
367
+
368
+ </li>
369
+
370
+ </ul>
371
+
372
+ </div><table class="source_code">
373
+ <tr>
374
+ <td>
375
+ <pre class="lines">
376
+
377
+
378
+ 16
379
+ 17
380
+ 18</pre>
381
+ </td>
382
+ <td>
383
+ <pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line 16</span>
384
+
385
+ <span class='kw'>def</span> <span class='id identifier rubyid_myid'>myid</span>
386
+ <span class='id identifier rubyid_inspect'>inspect</span>
387
+ <span class='kw'>end</span></pre>
388
+ </td>
389
+ </tr>
390
+ </table>
391
+ </div>
392
+
393
+ <div class="method_details ">
394
+ <h3 class="signature " id="tail-instance_method">
395
+
396
+ #<strong>tail</strong>(other) &#x21d2; <tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>
397
+
398
+
399
+
400
+ <span class="aliases">Also known as:
401
+ <span class="names"><span id='/-instance_method'>/</span></span>
402
+ </span>
403
+
404
+
405
+
406
+ </h3><div class="docstring">
407
+ <div class="discussion">
408
+
409
+ <p>Returns an Array with the Object being the head and the other Object being the tail.</p>
410
+
411
+
412
+ </div>
413
+ </div>
414
+ <div class="tags">
415
+
416
+ <div class="examples">
417
+ <p class="tag_title">Examples:</p>
418
+
419
+
420
+ <pre class="example code"><code><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>head</span><span class='tstring_end'>&#39;</span></span> <span class='op'>/</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>body</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>foot</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='comment'># ==&gt; [&#39;head&#39;, &#39;body&#39;, &#39;foot&#39;]
421
+ </span><span class='int'>7</span><span class='period'>.</span><span class='id identifier rubyid_tail'>tail</span><span class='lparen'>(</span><span class='symbol'>:t</span><span class='rparen'>)</span> <span class='comment'># ==&gt; [7, *:t]</span></code></pre>
422
+
423
+ </div>
424
+ <p class="tag_title">Parameters:</p>
425
+ <ul class="param">
426
+
427
+ <li>
428
+
429
+ <span class='name'>other</span>
430
+
431
+
432
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Object (class)">Object</a></span></tt>)</span>
433
+
434
+
435
+
436
+ &mdash;
437
+ <div class='inline'>
438
+ <p>the Object which is to be the tail</p>
439
+ </div>
440
+
441
+ </li>
442
+
443
+ </ul>
444
+
445
+ <p class="tag_title">Returns:</p>
446
+ <ul class="return">
447
+
448
+ <li>
449
+
450
+
451
+ <span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>)</span>
452
+
453
+
454
+
455
+ &mdash;
456
+ <div class='inline'>
457
+ <p>an Array with the Object being the head and the other Object being the tail.</p>
458
+ </div>
459
+
460
+ </li>
461
+
462
+ </ul>
463
+
464
+ </div><table class="source_code">
465
+ <tr>
466
+ <td>
467
+ <pre class="lines">
468
+
469
+
470
+ 40
471
+ 41
472
+ 42</pre>
473
+ </td>
474
+ <td>
475
+ <pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line 40</span>
476
+
477
+ <span class='kw'>def</span> <span class='id identifier rubyid_tail'>tail</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
478
+ <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>
479
+ <span class='kw'>end</span></pre>
480
+ </td>
481
+ </tr>
482
+ </table>
483
+ </div>
484
+
485
+ <div class="method_details ">
486
+ <h3 class="signature " id="type-instance_method">
487
+
488
+ #<strong>type</strong> &#x21d2; <tt><span class='object_link'><a href="Symbol.html" title="Symbol (class)">Symbol</a></span></tt>
489
+
490
+
491
+
492
+
493
+
494
+ </h3><div class="docstring">
495
+ <div class="discussion">
496
+
497
+ <p>Returns the type of the object (for an Object, should be :atomic)</p>
498
+
499
+
500
+ </div>
501
+ </div>
502
+ <div class="tags">
503
+
504
+ <p class="tag_title">Returns:</p>
505
+ <ul class="return">
506
+
507
+ <li>
508
+
509
+
510
+ <span class='type'>(<tt><span class='object_link'><a href="Symbol.html" title="Symbol (class)">Symbol</a></span></tt>)</span>
511
+
512
+
513
+
514
+ &mdash;
515
+ <div class='inline'>
516
+ <p>the type of the object (for an Object, should be :atomic)</p>
517
+ </div>
518
+
519
+ </li>
520
+
521
+ </ul>
522
+
523
+ </div><table class="source_code">
524
+ <tr>
525
+ <td>
526
+ <pre class="lines">
527
+
528
+
529
+ 26
530
+ 27
531
+ 28</pre>
532
+ </td>
533
+ <td>
534
+ <pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line 26</span>
535
+
536
+ <span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
537
+ <span class='symbol'>:atomic</span>
538
+ <span class='kw'>end</span></pre>
539
+ </td>
540
+ </tr>
541
+ </table>
542
+ </div>
543
+
544
+ <div class="method_details ">
545
+ <h3 class="signature " id="value-instance_method">
546
+
547
+ #<strong>value</strong> &#x21d2; <tt><span class='object_link'><a href="" title="Object (class)">Object</a></span></tt>
548
+
549
+
550
+
551
+
552
+
553
+ </h3><div class="docstring">
554
+ <div class="discussion">
555
+
556
+ <p>Returns the value of the object, which is itself.</p>
557
+
558
+
559
+ </div>
560
+ </div>
561
+ <div class="tags">
562
+
563
+ <p class="tag_title">Returns:</p>
564
+ <ul class="return">
565
+
566
+ <li>
567
+
568
+
569
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Object (class)">Object</a></span></tt>)</span>
570
+
571
+
572
+
573
+ &mdash;
574
+ <div class='inline'>
575
+ <p>the value of the object, which is itself.</p>
576
+ </div>
577
+
578
+ </li>
579
+
580
+ </ul>
581
+
582
+ </div><table class="source_code">
583
+ <tr>
584
+ <td>
585
+ <pre class="lines">
586
+
587
+
588
+ 31
589
+ 32
590
+ 33</pre>
591
+ </td>
592
+ <td>
593
+ <pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line 31</span>
594
+
595
+ <span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span><span class='lparen'>(</span><span class='op'>*</span><span class='rparen'>)</span>
596
+ <span class='kw'>self</span>
597
+ <span class='kw'>end</span></pre>
598
+ </td>
599
+ </tr>
600
+ </table>
601
+ </div>
602
+
603
+ <div class="method_details ">
604
+ <h3 class="signature " id="variables-instance_method">
605
+
606
+ #<strong>variables</strong> &#x21d2; <tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>
607
+
608
+
609
+
610
+
611
+
612
+ </h3><div class="docstring">
613
+ <div class="discussion">
614
+
615
+ <p>Returns embedded variables (for an Object, should be none).</p>
616
+
617
+
618
+ </div>
619
+ </div>
620
+ <div class="tags">
621
+
622
+ <p class="tag_title">Returns:</p>
623
+ <ul class="return">
624
+
625
+ <li>
626
+
627
+
628
+ <span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>)</span>
629
+
630
+
631
+
632
+ &mdash;
633
+ <div class='inline'>
634
+ <p>embedded variables (for an Object, should be none).</p>
635
+ </div>
636
+
637
+ </li>
638
+
639
+ </ul>
640
+
641
+ </div><table class="source_code">
642
+ <tr>
643
+ <td>
644
+ <pre class="lines">
645
+
646
+
647
+ 21
648
+ 22
649
+ 23</pre>
650
+ </td>
651
+ <td>
652
+ <pre class="code"><span class="info file"># File 'lib/porolog/core_ext.rb', line 21</span>
653
+
654
+ <span class='kw'>def</span> <span class='id identifier rubyid_variables'>variables</span>
655
+ <span class='lbracket'>[</span><span class='rbracket'>]</span>
656
+ <span class='kw'>end</span></pre>
657
+ </td>
658
+ </tr>
659
+ </table>
660
+ </div>
661
+
662
+ </div>
663
+
664
+ </div>
665
+
666
+ <div id="footer">
667
+ Generated on Sun Aug 2 19:24:17 2020 by
668
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
669
+ 0.9.19 (ruby-2.6.5).
670
+ </div>
671
+
672
+ </div>
673
+ </body>
674
+ </html>