mini_kraken 0.1.04 → 0.1.09

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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -1
  3. data/CHANGELOG.md +54 -0
  4. data/Gemfile +3 -1
  5. data/README.md +8 -6
  6. data/Rakefile +5 -3
  7. data/lib/mini_kraken.rb +3 -1
  8. data/lib/mini_kraken/core/any_value.rb +9 -7
  9. data/lib/mini_kraken/core/association.rb +20 -7
  10. data/lib/mini_kraken/core/association_walker.rb +5 -1
  11. data/lib/mini_kraken/core/atomic_term.rb +5 -3
  12. data/lib/mini_kraken/core/binary_relation.rb +8 -6
  13. data/lib/mini_kraken/core/composite_goal.rb +46 -0
  14. data/lib/mini_kraken/core/composite_term.rb +7 -20
  15. data/lib/mini_kraken/core/conj2.rb +76 -0
  16. data/lib/mini_kraken/core/cons_cell.rb +51 -41
  17. data/lib/mini_kraken/core/designation.rb +55 -0
  18. data/lib/mini_kraken/core/disj2.rb +71 -0
  19. data/lib/mini_kraken/core/duck_fiber.rb +4 -2
  20. data/lib/mini_kraken/core/environment.rb +25 -11
  21. data/lib/mini_kraken/core/equals.rb +127 -188
  22. data/lib/mini_kraken/core/fail.rb +20 -14
  23. data/lib/mini_kraken/core/freshness.rb +11 -8
  24. data/lib/mini_kraken/core/goal.rb +8 -4
  25. data/lib/mini_kraken/core/goal_arg.rb +10 -0
  26. data/lib/mini_kraken/core/goal_relation.rb +28 -0
  27. data/lib/mini_kraken/core/k_integer.rb +4 -3
  28. data/lib/mini_kraken/core/k_symbol.rb +4 -3
  29. data/lib/mini_kraken/core/nullary_relation.rb +3 -1
  30. data/lib/mini_kraken/core/outcome.rb +29 -25
  31. data/lib/mini_kraken/core/relation.rb +4 -18
  32. data/lib/mini_kraken/core/succeed.rb +20 -14
  33. data/lib/mini_kraken/core/term.rb +7 -2
  34. data/lib/mini_kraken/core/variable.rb +11 -25
  35. data/lib/mini_kraken/core/variable_ref.rb +12 -59
  36. data/lib/mini_kraken/core/vocabulary.rb +267 -48
  37. data/lib/mini_kraken/glue/fresh_env.rb +44 -6
  38. data/lib/mini_kraken/glue/run_star_expression.rb +49 -23
  39. data/lib/mini_kraken/version.rb +3 -1
  40. data/mini_kraken.gemspec +15 -13
  41. data/spec/core/association_spec.rb +4 -4
  42. data/spec/core/association_walker_spec.rb +25 -24
  43. data/spec/core/conj2_spec.rb +114 -0
  44. data/spec/core/cons_cell_spec.rb +12 -3
  45. data/spec/core/disj2_spec.rb +99 -0
  46. data/spec/core/duck_fiber_spec.rb +22 -12
  47. data/spec/core/environment_spec.rb +16 -28
  48. data/spec/core/equals_spec.rb +7 -7
  49. data/spec/core/fail_spec.rb +7 -7
  50. data/spec/core/goal_spec.rb +10 -10
  51. data/spec/core/k_symbol_spec.rb +5 -6
  52. data/spec/core/succeed_spec.rb +4 -4
  53. data/spec/core/variable_ref_spec.rb +0 -4
  54. data/spec/core/vocabulary_spec.rb +33 -27
  55. data/spec/glue/fresh_env_spec.rb +28 -2
  56. data/spec/glue/run_star_expression_spec.rb +370 -59
  57. data/spec/mini_kraken_spec.rb +4 -0
  58. data/spec/spec_helper.rb +3 -2
  59. data/spec/support/factory_methods.rb +20 -2
  60. metadata +12 -2
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/mini_kraken/version/'
4
+
1
5
  RSpec.describe MiniKraken do
2
6
  it 'has a version number' do
3
7
  expect(MiniKraken::VERSION).not_to be nil
@@ -1,9 +1,10 @@
1
- require 'bundler/setup'
1
+ # frozen_string_literal: true
2
+
2
3
  require 'rspec' # Use the RSpec framework
3
4
 
4
5
  RSpec.configure do |config|
5
6
  # Enable flags like --only-failures and --next-failure
6
- config.example_status_persistence_file_path = ".rspec_status"
7
+ config.example_status_persistence_file_path = '.rspec_status'
7
8
 
8
9
  config.expect_with :rspec do |c|
9
10
  # Disable the `should` syntax
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../../lib/mini_kraken/core/any_value'
2
4
  require_relative '../../lib/mini_kraken/core/cons_cell'
3
5
  require_relative '../../lib/mini_kraken/core/k_symbol'
@@ -32,6 +34,22 @@ module MiniKraken
32
34
  Core::Goal.new(Core::Equals.instance, [arg1, arg2])
33
35
  end
34
36
 
37
+ # Factory method for constructing a goal using the conjunction relation.
38
+ # @param g1 [Core::Goal]
39
+ # @param g2 [Core::Goal]
40
+ # @return [Core::Goal]
41
+ def conj2_goal(g1, g2)
42
+ Core::Goal.new(Core::Conj2.instance, [g1, g2])
43
+ end
44
+
45
+ # Factory method for constructing a goal using the disjunction relation.
46
+ # @param g1 [Core::Goal]
47
+ # @param g2 [Core::Goal]
48
+ # @return [Core::Goal]
49
+ def disj2_goal(g1, g2)
50
+ Core::Goal.new(Core::Disj2.instance, [g1, g2])
51
+ end
52
+
35
53
  # Factory method for constructing a KSymbol instance
36
54
  # @param aSymbol [Symbol]
37
55
  # @return [Core::KSymbol]
@@ -42,7 +60,7 @@ module MiniKraken
42
60
  # Factory method for constructing a Variable
43
61
  # @param var_name [String]
44
62
  # @return [Core::Variable]
45
- def var_ref(var_name)
63
+ def variable(var_name)
46
64
  Core::Variable.new(var_name)
47
65
  end
48
66
 
@@ -53,4 +71,4 @@ module MiniKraken
53
71
  Core::VariableRef.new(var_name)
54
72
  end
55
73
  end # end
56
- end # module
74
+ end # module
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_kraken
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.04
4
+ version: 0.1.09
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitri Geshef
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-02 00:00:00.000000000 Z
11
+ date: 2020-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,14 +73,20 @@ files:
73
73
  - lib/mini_kraken/core/association_walker.rb
74
74
  - lib/mini_kraken/core/atomic_term.rb
75
75
  - lib/mini_kraken/core/binary_relation.rb
76
+ - lib/mini_kraken/core/composite_goal.rb
76
77
  - lib/mini_kraken/core/composite_term.rb
78
+ - lib/mini_kraken/core/conj2.rb
77
79
  - lib/mini_kraken/core/cons_cell.rb
80
+ - lib/mini_kraken/core/designation.rb
81
+ - lib/mini_kraken/core/disj2.rb
78
82
  - lib/mini_kraken/core/duck_fiber.rb
79
83
  - lib/mini_kraken/core/environment.rb
80
84
  - lib/mini_kraken/core/equals.rb
81
85
  - lib/mini_kraken/core/fail.rb
82
86
  - lib/mini_kraken/core/freshness.rb
83
87
  - lib/mini_kraken/core/goal.rb
88
+ - lib/mini_kraken/core/goal_arg.rb
89
+ - lib/mini_kraken/core/goal_relation.rb
84
90
  - lib/mini_kraken/core/k_integer.rb
85
91
  - lib/mini_kraken/core/k_symbol.rb
86
92
  - lib/mini_kraken/core/nullary_relation.rb
@@ -97,7 +103,9 @@ files:
97
103
  - mini_kraken.gemspec
98
104
  - spec/core/association_spec.rb
99
105
  - spec/core/association_walker_spec.rb
106
+ - spec/core/conj2_spec.rb
100
107
  - spec/core/cons_cell_spec.rb
108
+ - spec/core/disj2_spec.rb
101
109
  - spec/core/duck_fiber_spec.rb
102
110
  - spec/core/environment_spec.rb
103
111
  - spec/core/equals_spec.rb
@@ -140,7 +148,9 @@ summary: Implementation of Minikanren language in Ruby. WIP
140
148
  test_files:
141
149
  - spec/core/association_spec.rb
142
150
  - spec/core/association_walker_spec.rb
151
+ - spec/core/conj2_spec.rb
143
152
  - spec/core/cons_cell_spec.rb
153
+ - spec/core/disj2_spec.rb
144
154
  - spec/core/duck_fiber_spec.rb
145
155
  - spec/core/environment_spec.rb
146
156
  - spec/core/equals_spec.rb