mini_kraken 0.2.00 → 0.3.00
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/.rubocop.yml +334 -0
- data/CHANGELOG.md +50 -0
- data/README.md +26 -24
- data/lib/mini_kraken.rb +2 -3
- data/lib/mini_kraken/atomic/all_atomic.rb +5 -0
- data/lib/mini_kraken/atomic/atomic_term.rb +96 -0
- data/lib/mini_kraken/atomic/k_boolean.rb +42 -0
- data/lib/mini_kraken/{core → atomic}/k_integer.rb +2 -5
- data/lib/mini_kraken/atomic/k_string.rb +17 -0
- data/lib/mini_kraken/{core → atomic}/k_symbol.rb +5 -9
- data/lib/mini_kraken/composite/all_composite.rb +4 -0
- data/lib/mini_kraken/composite/composite_term.rb +27 -0
- data/lib/mini_kraken/composite/cons_cell.rb +299 -0
- data/lib/mini_kraken/composite/cons_cell_visitor.rb +50 -0
- data/lib/mini_kraken/composite/list.rb +32 -0
- data/lib/mini_kraken/core/all_core.rb +8 -0
- data/lib/mini_kraken/core/any_value.rb +31 -7
- data/lib/mini_kraken/core/arity.rb +69 -0
- data/lib/mini_kraken/core/association.rb +29 -4
- data/lib/mini_kraken/core/association_copy.rb +50 -0
- data/lib/mini_kraken/core/base_term.rb +13 -0
- data/lib/mini_kraken/core/blackboard.rb +315 -0
- data/lib/mini_kraken/core/bookmark.rb +46 -0
- data/lib/mini_kraken/core/context.rb +624 -0
- data/lib/mini_kraken/core/duck_fiber.rb +21 -19
- data/lib/mini_kraken/core/entry.rb +40 -0
- data/lib/mini_kraken/core/fail.rb +20 -18
- data/lib/mini_kraken/core/fusion.rb +29 -0
- data/lib/mini_kraken/core/goal.rb +21 -29
- data/lib/mini_kraken/core/log_var.rb +22 -0
- data/lib/mini_kraken/core/log_var_ref.rb +108 -0
- data/lib/mini_kraken/core/nullary_relation.rb +2 -9
- data/lib/mini_kraken/core/parametrized_term.rb +61 -0
- data/lib/mini_kraken/core/relation.rb +14 -28
- data/lib/mini_kraken/core/scope.rb +67 -0
- data/lib/mini_kraken/core/solver_adapter.rb +58 -0
- data/lib/mini_kraken/core/specification.rb +48 -0
- data/lib/mini_kraken/core/succeed.rb +21 -17
- data/lib/mini_kraken/core/symbol_table.rb +137 -0
- data/lib/mini_kraken/core/term.rb +15 -4
- data/lib/mini_kraken/glue/dsl.rb +134 -32
- data/lib/mini_kraken/glue/run_star_expression.rb +28 -32
- data/lib/mini_kraken/rela/all_rela.rb +8 -0
- data/lib/mini_kraken/rela/binary_relation.rb +30 -0
- data/lib/mini_kraken/rela/conde.rb +146 -0
- data/lib/mini_kraken/rela/conj2.rb +65 -0
- data/lib/mini_kraken/rela/def_relation.rb +64 -0
- data/lib/mini_kraken/rela/disj2.rb +70 -0
- data/lib/mini_kraken/rela/fresh.rb +98 -0
- data/lib/mini_kraken/{core → rela}/goal_relation.rb +7 -9
- data/lib/mini_kraken/rela/unify.rb +258 -0
- data/lib/mini_kraken/version.rb +1 -1
- data/mini_kraken.gemspec +6 -3
- data/spec/.rubocop.yml +13 -0
- data/spec/atomic/atomic_term_spec.rb +97 -0
- data/spec/{core → atomic}/k_boolean_spec.rb +25 -34
- data/spec/{core → atomic}/k_symbol_spec.rb +4 -17
- data/spec/composite/cons_cell_spec.rb +225 -0
- data/spec/composite/cons_cell_visitor_spec.rb +158 -0
- data/spec/composite/list_spec.rb +50 -0
- data/spec/core/any_value_spec.rb +52 -0
- data/spec/core/arity_spec.rb +91 -0
- data/spec/core/association_copy_spec.rb +69 -0
- data/spec/core/association_spec.rb +31 -4
- data/spec/core/blackboard_spec.rb +287 -0
- data/spec/core/bookmark_spec.rb +40 -0
- data/spec/core/context_spec.rb +221 -0
- data/spec/core/core_spec.rb +40 -0
- data/spec/core/duck_fiber_spec.rb +22 -46
- data/spec/core/fail_spec.rb +5 -6
- data/spec/core/goal_spec.rb +24 -14
- data/spec/core/log_var_ref_spec.rb +105 -0
- data/spec/core/log_var_spec.rb +64 -0
- data/spec/core/nullary_relation_spec.rb +33 -0
- data/spec/core/parametrized_tem_spec.rb +39 -0
- data/spec/core/relation_spec.rb +33 -0
- data/spec/core/scope_spec.rb +73 -0
- data/spec/core/solver_adapter_spec.rb +70 -0
- data/spec/core/specification_spec.rb +43 -0
- data/spec/core/succeed_spec.rb +5 -5
- data/spec/core/symbol_table_spec.rb +142 -0
- data/spec/glue/dsl_chap1_spec.rb +250 -125
- data/spec/glue/dsl_chap2_spec.rb +226 -0
- data/spec/glue/run_star_expression_spec.rb +82 -906
- data/spec/rela/conde_spec.rb +153 -0
- data/spec/rela/conj2_spec.rb +123 -0
- data/spec/rela/def_relation_spec.rb +119 -0
- data/spec/rela/disj2_spec.rb +117 -0
- data/spec/rela/fresh_spec.rb +147 -0
- data/spec/rela/unify_spec.rb +369 -0
- data/spec/support/factory_atomic.rb +29 -0
- data/spec/support/factory_composite.rb +21 -0
- data/spec/support/factory_methods.rb +11 -26
- metadata +102 -64
- data/lib/mini_kraken/core/association_walker.rb +0 -183
- data/lib/mini_kraken/core/atomic_term.rb +0 -66
- data/lib/mini_kraken/core/base_arg.rb +0 -10
- data/lib/mini_kraken/core/binary_relation.rb +0 -63
- data/lib/mini_kraken/core/composite_goal.rb +0 -46
- data/lib/mini_kraken/core/composite_term.rb +0 -41
- data/lib/mini_kraken/core/conde.rb +0 -143
- data/lib/mini_kraken/core/conj2.rb +0 -79
- data/lib/mini_kraken/core/cons_cell.rb +0 -81
- data/lib/mini_kraken/core/def_relation.rb +0 -49
- data/lib/mini_kraken/core/designation.rb +0 -55
- data/lib/mini_kraken/core/disj2.rb +0 -72
- data/lib/mini_kraken/core/environment.rb +0 -73
- data/lib/mini_kraken/core/equals.rb +0 -159
- data/lib/mini_kraken/core/formal_arg.rb +0 -22
- data/lib/mini_kraken/core/formal_ref.rb +0 -24
- data/lib/mini_kraken/core/freshness.rb +0 -45
- data/lib/mini_kraken/core/goal_arg.rb +0 -12
- data/lib/mini_kraken/core/goal_template.rb +0 -60
- data/lib/mini_kraken/core/k_boolean.rb +0 -31
- data/lib/mini_kraken/core/outcome.rb +0 -53
- data/lib/mini_kraken/core/variable.rb +0 -41
- data/lib/mini_kraken/core/variable_ref.rb +0 -77
- data/lib/mini_kraken/core/vocabulary.rb +0 -442
- data/lib/mini_kraken/glue/fresh_env.rb +0 -75
- data/spec/core/association_walker_spec.rb +0 -192
- data/spec/core/conde_spec.rb +0 -147
- data/spec/core/conj2_spec.rb +0 -114
- data/spec/core/cons_cell_spec.rb +0 -107
- data/spec/core/def_relation_spec.rb +0 -96
- data/spec/core/disj2_spec.rb +0 -99
- data/spec/core/environment_spec.rb +0 -142
- data/spec/core/equals_spec.rb +0 -304
- data/spec/core/goal_template_spec.rb +0 -74
- data/spec/core/outcome_spec.rb +0 -48
- data/spec/core/variable_ref_spec.rb +0 -27
- data/spec/core/variable_spec.rb +0 -35
- data/spec/core/vocabulary_spec.rb +0 -219
- data/spec/glue/fresh_env_spec.rb +0 -62
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ceccf4c9ffeb71fc8759bbf1ea1db003d83e9e150df95793de7e729716c9538d
|
|
4
|
+
data.tar.gz: bab9d4b22a86eec0fcd95955a799a40bfd51c032d05a56b5c2569e0e833b4d2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b8dac966209d3209419b2721c67ecd9ec1d1985b0a457877def4e9eda3a305b6952d996e1791436db33f863a046553df1567ef142fc7fe6d5d8092b7d0e2ecd
|
|
7
|
+
data.tar.gz: 5c99a985287a32d2e6a2c6dbbcabeaea07203e533372183817660eb2259edda6465b4993997b9dcb8dd0db59e0b69772f31409f17a587a3d55381d7f06151a74
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
Exclude:
|
|
3
|
+
- 'exp/**/*'
|
|
4
|
+
|
|
5
|
+
Layout/ArgumentAlignment:
|
|
6
|
+
Enabled: false
|
|
7
|
+
|
|
8
|
+
Layout/ArrayAlignment:
|
|
9
|
+
Enabled: true
|
|
10
|
+
EnforcedStyle: with_fixed_indentation
|
|
11
|
+
|
|
12
|
+
Layout/CaseIndentation:
|
|
13
|
+
Enabled: false
|
|
14
|
+
|
|
15
|
+
Layout/ClosingHeredocIndentation:
|
|
16
|
+
Enabled: false
|
|
17
|
+
|
|
18
|
+
Layout/CommentIndentation:
|
|
19
|
+
Enabled: false
|
|
20
|
+
|
|
21
|
+
Layout/ElseAlignment:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
Layout/EmptyLines:
|
|
25
|
+
Enabled: false
|
|
26
|
+
|
|
27
|
+
Layout/EndAlignment:
|
|
28
|
+
Enabled: false
|
|
29
|
+
|
|
30
|
+
Layout/EndOfLine:
|
|
31
|
+
Enabled: true
|
|
32
|
+
EnforcedStyle: lf
|
|
33
|
+
|
|
34
|
+
Layout/FirstArgumentIndentation:
|
|
35
|
+
Enabled: false
|
|
36
|
+
|
|
37
|
+
Layout/IndentationWidth:
|
|
38
|
+
Enabled: false
|
|
39
|
+
|
|
40
|
+
Layout/IndentationConsistency:
|
|
41
|
+
Enabled: true
|
|
42
|
+
|
|
43
|
+
Layout/HeredocIndentation:
|
|
44
|
+
Enabled: false
|
|
45
|
+
|
|
46
|
+
Layout/MultilineHashBraceLayout:
|
|
47
|
+
Enabled: true
|
|
48
|
+
|
|
49
|
+
Layout/MultilineMethodCallBraceLayout:
|
|
50
|
+
Enabled: true
|
|
51
|
+
EnforcedStyle: same_line
|
|
52
|
+
|
|
53
|
+
Layout/SpaceAroundOperators:
|
|
54
|
+
Enabled: true
|
|
55
|
+
|
|
56
|
+
Layout/SpaceInsideParens:
|
|
57
|
+
Enabled: true
|
|
58
|
+
|
|
59
|
+
Layout/IndentationStyle:
|
|
60
|
+
Enabled: true
|
|
61
|
+
|
|
62
|
+
Layout/SpaceAroundMethodCallOperator:
|
|
63
|
+
Enabled: true
|
|
64
|
+
|
|
65
|
+
Layout/TrailingEmptyLines:
|
|
66
|
+
Enabled: true
|
|
67
|
+
|
|
68
|
+
Layout/TrailingWhitespace:
|
|
69
|
+
Enabled: true
|
|
70
|
+
|
|
71
|
+
Lint/Loop:
|
|
72
|
+
Enabled: true
|
|
73
|
+
|
|
74
|
+
Lint/RaiseException:
|
|
75
|
+
Enabled: true
|
|
76
|
+
|
|
77
|
+
Lint/RescueException:
|
|
78
|
+
Enabled: true
|
|
79
|
+
|
|
80
|
+
Lint/StructNewOverride:
|
|
81
|
+
Enabled: true
|
|
82
|
+
|
|
83
|
+
Lint/UnusedMethodArgument:
|
|
84
|
+
Enabled: true
|
|
85
|
+
|
|
86
|
+
Lint/UselessAccessModifier:
|
|
87
|
+
Enabled: true
|
|
88
|
+
|
|
89
|
+
Lint/Void:
|
|
90
|
+
Enabled: false
|
|
91
|
+
|
|
92
|
+
Lint/UselessAssignment:
|
|
93
|
+
Enabled: true
|
|
94
|
+
|
|
95
|
+
Metrics/AbcSize:
|
|
96
|
+
Enabled: false
|
|
97
|
+
|
|
98
|
+
Metrics/BlockLength:
|
|
99
|
+
Enabled: true
|
|
100
|
+
Max: 350
|
|
101
|
+
|
|
102
|
+
Metrics/BlockNesting:
|
|
103
|
+
Enabled: true
|
|
104
|
+
Max: 5
|
|
105
|
+
|
|
106
|
+
Metrics/ClassLength:
|
|
107
|
+
Enabled: true
|
|
108
|
+
Max: 350
|
|
109
|
+
|
|
110
|
+
Metrics/CyclomaticComplexity:
|
|
111
|
+
Enabled: false
|
|
112
|
+
|
|
113
|
+
Layout/LineLength:
|
|
114
|
+
Enabled: false
|
|
115
|
+
Max: 90
|
|
116
|
+
|
|
117
|
+
Metrics/MethodLength:
|
|
118
|
+
Enabled: true
|
|
119
|
+
Max: 50
|
|
120
|
+
|
|
121
|
+
Metrics/ModuleLength:
|
|
122
|
+
Enabled: true
|
|
123
|
+
Max: 500
|
|
124
|
+
|
|
125
|
+
Metrics/PerceivedComplexity:
|
|
126
|
+
Enabled: false
|
|
127
|
+
|
|
128
|
+
Naming/ConstantName:
|
|
129
|
+
Enabled: false
|
|
130
|
+
|
|
131
|
+
Naming/ClassAndModuleCamelCase:
|
|
132
|
+
Enabled: false
|
|
133
|
+
|
|
134
|
+
Naming/BlockParameterName:
|
|
135
|
+
Enabled: true
|
|
136
|
+
|
|
137
|
+
Naming/MethodParameterName:
|
|
138
|
+
Enabled: false
|
|
139
|
+
|
|
140
|
+
Naming/VariableName:
|
|
141
|
+
Enabled: false
|
|
142
|
+
|
|
143
|
+
Style/Alias:
|
|
144
|
+
Enabled: true
|
|
145
|
+
|
|
146
|
+
Layout/HashAlignment:
|
|
147
|
+
Enabled: false
|
|
148
|
+
|
|
149
|
+
Style/AsciiComments:
|
|
150
|
+
Enabled: false
|
|
151
|
+
|
|
152
|
+
Style/BarePercentLiterals:
|
|
153
|
+
Enabled: false
|
|
154
|
+
|
|
155
|
+
Style/BlockComments:
|
|
156
|
+
Enabled: false
|
|
157
|
+
|
|
158
|
+
Style/CharacterLiteral:
|
|
159
|
+
Enabled: false
|
|
160
|
+
|
|
161
|
+
Style/ClassCheck:
|
|
162
|
+
Enabled: false
|
|
163
|
+
|
|
164
|
+
Style/ClassVars:
|
|
165
|
+
Enabled: false
|
|
166
|
+
|
|
167
|
+
Style/ColonMethodCall:
|
|
168
|
+
Enabled: false
|
|
169
|
+
|
|
170
|
+
Style/CommentAnnotation:
|
|
171
|
+
Enabled: false
|
|
172
|
+
|
|
173
|
+
Style/CommentedKeyword:
|
|
174
|
+
Enabled: false
|
|
175
|
+
|
|
176
|
+
Style/ConditionalAssignment:
|
|
177
|
+
Enabled: false
|
|
178
|
+
|
|
179
|
+
Style/DefWithParentheses:
|
|
180
|
+
Enabled: true
|
|
181
|
+
|
|
182
|
+
Style/Documentation:
|
|
183
|
+
Enabled: false
|
|
184
|
+
|
|
185
|
+
Style/ExpandPathArguments:
|
|
186
|
+
Enabled: false
|
|
187
|
+
|
|
188
|
+
Style/ExponentialNotation:
|
|
189
|
+
Enabled: true
|
|
190
|
+
|
|
191
|
+
Style/GuardClause:
|
|
192
|
+
Enabled: false
|
|
193
|
+
|
|
194
|
+
Style/HashEachMethods:
|
|
195
|
+
Enabled: true
|
|
196
|
+
|
|
197
|
+
Style/HashTransformKeys:
|
|
198
|
+
Enabled: true
|
|
199
|
+
|
|
200
|
+
Style/HashTransformValues:
|
|
201
|
+
Enabled: true
|
|
202
|
+
|
|
203
|
+
Style/IfUnlessModifier:
|
|
204
|
+
Enabled: false
|
|
205
|
+
|
|
206
|
+
Style/InverseMethods:
|
|
207
|
+
Enabled: true
|
|
208
|
+
|
|
209
|
+
Style/MissingRespondToMissing:
|
|
210
|
+
Enabled: false
|
|
211
|
+
|
|
212
|
+
Style/Next:
|
|
213
|
+
Enabled: false
|
|
214
|
+
|
|
215
|
+
Style/NumericLiterals:
|
|
216
|
+
Enabled: false
|
|
217
|
+
|
|
218
|
+
Style/RaiseArgs:
|
|
219
|
+
Enabled: true
|
|
220
|
+
|
|
221
|
+
Style/RedundantReturn:
|
|
222
|
+
Enabled: false
|
|
223
|
+
|
|
224
|
+
Style/RedundantSelf:
|
|
225
|
+
Enabled: true
|
|
226
|
+
|
|
227
|
+
Style/RegexpLiteral:
|
|
228
|
+
Enabled: false
|
|
229
|
+
|
|
230
|
+
Style/PercentLiteralDelimiters:
|
|
231
|
+
Enabled: false
|
|
232
|
+
|
|
233
|
+
Style/StderrPuts:
|
|
234
|
+
Enabled: false
|
|
235
|
+
|
|
236
|
+
Style/StringLiterals:
|
|
237
|
+
Enabled: true
|
|
238
|
+
|
|
239
|
+
Style/TernaryParentheses:
|
|
240
|
+
Enabled: false
|
|
241
|
+
|
|
242
|
+
Style/UnlessElse:
|
|
243
|
+
Enabled: false
|
|
244
|
+
|
|
245
|
+
# Rubocop complains when it doesn't find an explicit setting for the following cops:
|
|
246
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
|
247
|
+
Enabled: true
|
|
248
|
+
|
|
249
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
|
250
|
+
Enabled: true
|
|
251
|
+
|
|
252
|
+
Lint/DeprecatedOpenSSLConstant:
|
|
253
|
+
Enabled: true
|
|
254
|
+
|
|
255
|
+
Lint/DuplicateElsifCondition:
|
|
256
|
+
Enabled: true
|
|
257
|
+
|
|
258
|
+
Lint/DuplicateRescueException:
|
|
259
|
+
Enabled: true
|
|
260
|
+
|
|
261
|
+
Lint/EmptyConditionalBody:
|
|
262
|
+
Enabled: true
|
|
263
|
+
|
|
264
|
+
Lint/FloatComparison:
|
|
265
|
+
Enabled: true
|
|
266
|
+
|
|
267
|
+
Lint/MissingSuper:
|
|
268
|
+
Enabled: true
|
|
269
|
+
|
|
270
|
+
Lint/MixedRegexpCaptureTypes:
|
|
271
|
+
Enabled: true
|
|
272
|
+
|
|
273
|
+
Lint/OutOfRangeRegexpRef:
|
|
274
|
+
Enabled: true
|
|
275
|
+
|
|
276
|
+
Lint/SelfAssignment:
|
|
277
|
+
Enabled: true
|
|
278
|
+
|
|
279
|
+
Lint/TopLevelReturnWithArgument:
|
|
280
|
+
Enabled: true
|
|
281
|
+
|
|
282
|
+
Lint/UnreachableLoop:
|
|
283
|
+
Enabled: true
|
|
284
|
+
|
|
285
|
+
Style/AccessorGrouping:
|
|
286
|
+
Enabled: true
|
|
287
|
+
|
|
288
|
+
Style/ArrayCoercion:
|
|
289
|
+
Enabled: true
|
|
290
|
+
|
|
291
|
+
Style/BisectedAttrAccessor:
|
|
292
|
+
Enabled: true
|
|
293
|
+
|
|
294
|
+
Style/CaseLikeIf:
|
|
295
|
+
Enabled: true
|
|
296
|
+
|
|
297
|
+
Style/ExplicitBlockArgument:
|
|
298
|
+
Enabled: true
|
|
299
|
+
|
|
300
|
+
Style/GlobalStdStream:
|
|
301
|
+
Enabled: true
|
|
302
|
+
|
|
303
|
+
Style/HashAsLastArrayItem:
|
|
304
|
+
Enabled: true
|
|
305
|
+
|
|
306
|
+
Style/HashLikeCase:
|
|
307
|
+
Enabled: true
|
|
308
|
+
|
|
309
|
+
Style/OptionalBooleanParameter:
|
|
310
|
+
Enabled: true
|
|
311
|
+
|
|
312
|
+
Style/RedundantAssignment:
|
|
313
|
+
Enabled: true
|
|
314
|
+
|
|
315
|
+
Style/RedundantFetchBlock:
|
|
316
|
+
Enabled: true
|
|
317
|
+
|
|
318
|
+
Style/RedundantFileExtensionInRequire:
|
|
319
|
+
Enabled: true
|
|
320
|
+
|
|
321
|
+
Style/RedundantRegexpCharacterClass:
|
|
322
|
+
Enabled: true
|
|
323
|
+
|
|
324
|
+
Style/RedundantRegexpEscape:
|
|
325
|
+
Enabled: true
|
|
326
|
+
|
|
327
|
+
Style/SingleArgumentDig:
|
|
328
|
+
Enabled: true
|
|
329
|
+
|
|
330
|
+
Style/SlicingWithRange:
|
|
331
|
+
Enabled: true
|
|
332
|
+
|
|
333
|
+
Style/StringConcatenation:
|
|
334
|
+
Enabled: true
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,53 @@
|
|
|
1
|
+
## [0.3.00] - 2020-12-16
|
|
2
|
+
- Version number bump because this is a vast code rewrite
|
|
3
|
+
|
|
4
|
+
### CHANGED
|
|
5
|
+
- Most classes have been reworked
|
|
6
|
+
- Relation `Equals` has been renamed to `Unify`
|
|
7
|
+
|
|
8
|
+
## [0.2.04] - 2020-09-02
|
|
9
|
+
- Intermediate version before vast code rework.
|
|
10
|
+
|
|
11
|
+
### CHANGED
|
|
12
|
+
- Classes `KBoolean`, `KSymbol`, `KInteger` moved to namespace `Atomic`
|
|
13
|
+
- Classes `ConsCell`, `ConsCellVisitor` moved to namespace `Composite`
|
|
14
|
+
- Class `Variable` renamed to `LogVar`
|
|
15
|
+
- Class `VariableRef` renamed to `LogVarRef`
|
|
16
|
+
|
|
17
|
+
## [0.2.03] - 2020-09-02
|
|
18
|
+
- The DSL (Domain Specific Language) supports the `caro` relation & passes frames up to 2-8 from Chapter 2.
|
|
19
|
+
|
|
20
|
+
### NEW
|
|
21
|
+
- Class `ConsCellVisitor`. Its method `df_visitor` builds a Fiber that walks over a ConsCell (list/graph).
|
|
22
|
+
- Method `Outcome#failure?`
|
|
23
|
+
- Method `Outcome#prune!` for removing associations of transient variables.
|
|
24
|
+
- Method `VariableRef#to_s` for providing a text representation of a variable reference
|
|
25
|
+
- Method `Vocabulary#prune` for removing associations of transient variables.
|
|
26
|
+
- Class `FreshEnvFactory` as its name implies, is used to build `FreshEnv` instances.
|
|
27
|
+
|
|
28
|
+
### CHANGED
|
|
29
|
+
- Method `Outcome#successful?` renamed to `Outcome#success?`
|
|
30
|
+
|
|
31
|
+
### FIXED
|
|
32
|
+
- Method `Equals#solver_for` now prunes associations of transient variables.
|
|
33
|
+
- Method `Equals#unify_composite_terms` now copes with Conscell vs. VariableRef unification.
|
|
34
|
+
|
|
35
|
+
## [0.2.02] - 2020-08-08
|
|
36
|
+
- The DSL (Domain Specific Language) now supports `conde` and passes all examples from Chapter 1.
|
|
37
|
+
|
|
38
|
+
### NEW
|
|
39
|
+
- Method`Glue::DSL#conde` to implement conde goals.
|
|
40
|
+
- Method `KBoolean#to_s` returns a text representation of a boolean value.
|
|
41
|
+
|
|
42
|
+
## [0.2.01] - 2020-08-07
|
|
43
|
+
- The DSL (Domain Specific Language) now supports `defrel` and boolean literals.
|
|
44
|
+
|
|
45
|
+
### CHANGED
|
|
46
|
+
- Constructor `DefRelation#initialize` now freezes any new class instance.
|
|
47
|
+
- Constructor `GoalTemplate#initialize` now freezes any new class instance.
|
|
48
|
+
- Mixin module `Glue::DSL` new method `defrel` to build custom relations.
|
|
49
|
+
- File `.rubocop.yml` to please Rubocop 0.89
|
|
50
|
+
|
|
1
51
|
## [0.2.00] - 2020-07-12
|
|
2
52
|
- First release of DSL (Domain Specific Language)
|
|
3
53
|
- Fix defect for fused variables that remain fresh
|
data/README.md
CHANGED
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
[](https://github.com/famished-tiger/mini_kraken/blob/master/LICENSE.txt)
|
|
5
5
|
|
|
6
6
|
### What is __mini_kraken__ ?
|
|
7
|
-
A library containing an implementation of the [miniKanren](http://minikanren.org/)
|
|
8
|
-
|
|
9
|
-
*miniKanren* is a small language for relational (logic) programming.
|
|
10
|
-
Based on the reference implementation, in Scheme from the "The Reasoned Schemer" book.
|
|
7
|
+
A library containing an implementation in Ruby of the [miniKanren](http://minikanren.org/)
|
|
8
|
+
language.
|
|
9
|
+
*miniKanren* is a small language for relational (logic) programming as defined in the "The Reasoned Schemer" book.
|
|
11
10
|
Daniel P. Friedman, William E. Byrd, Oleg Kiselyov, and Jason Hemann: "The Reasoned Schemer", Second Edition,
|
|
12
11
|
ISBN: 9780262535519, (2018), MIT Press.
|
|
13
12
|
|
|
@@ -15,6 +14,7 @@ ISBN: 9780262535519, (2018), MIT Press.
|
|
|
15
14
|
- Pure Ruby implementation, not a port from another language
|
|
16
15
|
- Object-Oriented design
|
|
17
16
|
- No runtime dependencies
|
|
17
|
+
- Test suite patterned on the examples from the reference book.
|
|
18
18
|
|
|
19
19
|
### miniKanren Features
|
|
20
20
|
- [X] ==
|
|
@@ -23,19 +23,19 @@ ISBN: 9780262535519, (2018), MIT Press.
|
|
|
23
23
|
- [X] conde
|
|
24
24
|
- [X] conj2
|
|
25
25
|
- [X] disj2
|
|
26
|
-
- [X] defrel
|
|
26
|
+
- [X] defrel
|
|
27
|
+
- [X] caro
|
|
28
|
+
- [X] cdro
|
|
27
29
|
|
|
28
30
|
### TODO
|
|
29
31
|
|
|
30
32
|
- [ ] Occurs check
|
|
31
33
|
|
|
32
34
|
List-centric relations from Chapter 2
|
|
33
|
-
- [ ]
|
|
34
|
-
- [ ]
|
|
35
|
-
- [ ]
|
|
36
|
-
- [ ]
|
|
37
|
-
- [ ] pairo
|
|
38
|
-
- [ ] singletono
|
|
35
|
+
- [ ] conso
|
|
36
|
+
- [ ] nullo
|
|
37
|
+
- [ ] pairo
|
|
38
|
+
- [ ] singletono
|
|
39
39
|
|
|
40
40
|
## Installation
|
|
41
41
|
|
|
@@ -65,7 +65,7 @@ require 'mini_kraken' # Load MiniKraken library
|
|
|
65
65
|
|
|
66
66
|
extend(MiniKraken::Glue::DSL) # Add DSL method to self (object in context)
|
|
67
67
|
|
|
68
|
-
result = run_star('q',
|
|
68
|
+
result = run_star('q', unify(q, :pea))
|
|
69
69
|
puts result # => (:pea)
|
|
70
70
|
```
|
|
71
71
|
|
|
@@ -73,17 +73,17 @@ The two first lines in the above code snippet are pretty standard:
|
|
|
73
73
|
- The first line loads the `mini_kraken` library.
|
|
74
74
|
- The second line add the DSL methods to the current object.
|
|
75
75
|
|
|
76
|
-
The next line constitutes a trivial `miniKanren` program.
|
|
77
|
-
The aim of a `miniKanren` program is to find one or more solutions involving
|
|
78
|
-
and satisfying one or more goals.
|
|
76
|
+
The next line constitutes a trivial `miniKanren` program.
|
|
77
|
+
The aim of a `miniKanren` program is to find one or more solutions involving the given logical variable(s)
|
|
78
|
+
and satisfying one or more goals to the `run_star method.
|
|
79
79
|
In our example, the `run_star` method instructs `MiniKraken` to find all solutions,
|
|
80
80
|
knowing that each successful solution:
|
|
81
81
|
- binds a value to the provided variable `q` and
|
|
82
|
-
- meets the goal `
|
|
82
|
+
- meets the goal `unify(q, :pea)`.
|
|
83
83
|
|
|
84
|
-
The goal `
|
|
84
|
+
The goal `unify(q, :pea)` succeeds because the logical variable `q` is _fresh_ (that is,
|
|
85
85
|
not yet bound to a value) and will be bound to the symbol `:pea` as a side effect
|
|
86
|
-
of the goal `
|
|
86
|
+
of the goal `unify`.
|
|
87
87
|
|
|
88
88
|
So the above program succeeds and the only found solution is obtained by binding
|
|
89
89
|
the variable `q` to the value :pea. Hence the result of the `puts` method.
|
|
@@ -97,11 +97,12 @@ So the above program succeeds and the only found solution is obtained by binding
|
|
|
97
97
|
extend(MiniKraken::Glue::DSL) # Add DSL method to self (object in context)
|
|
98
98
|
|
|
99
99
|
# Following miniKanren program fails
|
|
100
|
-
result = run_star('q', [
|
|
100
|
+
result = run_star('q', [unify(q, :pea), unify(q, :pod)])
|
|
101
101
|
puts result # => ()
|
|
102
102
|
```
|
|
103
103
|
In this example, we learn that `run_star` can take multiple goals placed in an array.
|
|
104
|
-
The program fails to find a solution since it is not possible to satisfy the two `
|
|
104
|
+
The program fails to find a solution since it is not possible to satisfy the two `unify` goals simultaneously.
|
|
105
|
+
In case of failure, the `run_star` returns an empty list represented as `()` in the output.
|
|
105
106
|
|
|
106
107
|
|
|
107
108
|
### Example 3
|
|
@@ -110,7 +111,7 @@ The program fails to find a solution since it is not possible to satisfy the two
|
|
|
110
111
|
```ruby
|
|
111
112
|
# In this example and following, one assumes that DSL is loaded as shown in Example 1
|
|
112
113
|
|
|
113
|
-
result = run_star(['x', 'y'], [
|
|
114
|
+
result = run_star(['x', 'y'], [unify(:hello, x), unify(y, :world)])
|
|
114
115
|
puts result # => ((:hello :world))
|
|
115
116
|
```
|
|
116
117
|
|
|
@@ -121,13 +122,14 @@ This time, `run_star` takes two logical variables -`x` and `y`- and successfully
|
|
|
121
122
|
```ruby
|
|
122
123
|
result = run_star(['x', 'y'],
|
|
123
124
|
[
|
|
124
|
-
disj2(
|
|
125
|
-
disj2(
|
|
125
|
+
disj2(unify(x, :blue), unify(x, :red)),
|
|
126
|
+
disj2(unify(y, :sea), unify(:mountain, y))
|
|
126
127
|
])
|
|
127
128
|
puts result # => ((:blue :sea) (:blue :mountain) (:red :sea) (:red :mountain))
|
|
128
129
|
```
|
|
129
130
|
|
|
130
|
-
Here, `run_star` takes two logical variables and two `disj2` goals.
|
|
131
|
+
Here, `run_star` takes two logical variables and two `disj2` goals.
|
|
132
|
+
A `disj2` succeeds if any of its arguments succeeds.
|
|
131
133
|
This program finds four distinct solutions for x, y pairs.
|
|
132
134
|
|
|
133
135
|
## Development
|