mini_kraken 0.1.0 → 0.1.01
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/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/lib/mini_kraken.rb +6 -0
- data/lib/mini_kraken/core/facade.rb +45 -0
- data/lib/mini_kraken/core/fail.rb +18 -0
- data/lib/mini_kraken/core/formal_arg.rb +6 -0
- data/lib/mini_kraken/core/goal.rb +18 -0
- data/lib/mini_kraken/core/nullary_relation.rb +12 -0
- data/lib/mini_kraken/core/publisher.rb +27 -0
- data/lib/mini_kraken/core/relation.rb +17 -0
- data/lib/mini_kraken/core/run_star_expression.rb +34 -0
- data/lib/mini_kraken/core/succeed.rb +8 -0
- data/lib/mini_kraken/core/variable.rb +11 -0
- data/lib/mini_kraken/dsl/kraken_dsl.rb +12 -0
- data/lib/mini_kraken/version.rb +3 -0
- data/mini_kraken.gemspec +55 -0
- data/spec/core/facade_spec.rb +38 -0
- data/spec/core/fail_spec.rb +27 -0
- data/spec/core/goal_spec.rb +35 -0
- data/spec/core/run_star_expression_spec.rb +43 -0
- data/spec/core/variable_spec.rb +27 -0
- data/spec/dsl/kraken_dsl_spec.rb +31 -0
- data/spec/mini_kraken_spec.rb +5 -0
- data/spec/spec_helper.rb +15 -0
- metadata +46 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e60a12ea5711e80f10de8f1a2c018199975fc83baeecab2d15fdb2ea6c6b91c3
|
4
|
+
data.tar.gz: 8fd4f903f896ac08e13f00881592b7e81e4684f7eb9acd2f7be9d4b03fee6a2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5f333b6bfbb58f2726c1351fa672c95c1b3b171c322411ce87617f0a4e748f8bab1beecb0a4fc035dc15ec9ae382d2b1dd3fcd59707a37402db33a12248a878
|
7
|
+
data.tar.gz: '0196ee55adc9516fa4cfcea24dd74ec33b061771e9c273543d648d00b1244038d6c945a95b76f44c1c7f02f853f92a32a541ea051d5d6d5facf9d307640a2e13'
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
## [0.1.01] - 2020-03-01
|
2
|
+
First code commit
|
3
|
+
### Added
|
4
|
+
- In `Core` module: `Facade`, `Fail`, `FormalArg`, `Goal`, `NullaryRelation`, `Publisher`, `Relation`, `RunStarExpression`, `Succeed`, `Variable`
|
5
|
+
- File `CHANGELOG.md`. This file. Adopting `keepachangelog.com` recommended format.
|
6
|
+
- File `min_kraken.gemspec` Updated gem description.
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
- File `README.md` added badges (Appveyor build status, Gem version, license)
|
10
|
+
|
11
|
+
## [0.1.0] - 2020-02-05
|
12
|
+
### Added
|
13
|
+
- Initial Github commit as new project
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Dimitri Geshef
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# MiniKraken
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/mini_kraken`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'mini_kraken'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install mini_kraken
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/famished-tiger/mini_kraken.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/lib/mini_kraken.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative 'variable'
|
2
|
+
require_relative 'run_star_expression'
|
3
|
+
|
4
|
+
module MiniKraken
|
5
|
+
module Core
|
6
|
+
class Facade
|
7
|
+
attr_reader :publisher
|
8
|
+
def initialize(aPublisher)
|
9
|
+
@publisher = aPublisher
|
10
|
+
end
|
11
|
+
|
12
|
+
def run_star(theVariables, aGoal)
|
13
|
+
tuple = build_tuple(theVariables)
|
14
|
+
|
15
|
+
expr = RunStarExpression.new(tuple, aGoal)
|
16
|
+
expr.run(publisher)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def build_tuple(theVariables)
|
22
|
+
tuple = nil
|
23
|
+
if theVariables.kind_of?(Array)
|
24
|
+
tuple = theVariables.map { |v| build_single_var(v) }
|
25
|
+
else
|
26
|
+
tuple = [build_single_var(theVariables)]
|
27
|
+
end
|
28
|
+
|
29
|
+
tuple
|
30
|
+
end
|
31
|
+
|
32
|
+
def build_single_var(aVar)
|
33
|
+
var = nil
|
34
|
+
case aVar
|
35
|
+
when Symbol
|
36
|
+
var = Variable.new(aVar.to_s)
|
37
|
+
when String
|
38
|
+
var = Variable.new(aVar)
|
39
|
+
end
|
40
|
+
|
41
|
+
var
|
42
|
+
end
|
43
|
+
end # class
|
44
|
+
end # module
|
45
|
+
end # module
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
require_relative 'nullary_relation'
|
3
|
+
|
4
|
+
module MiniKraken
|
5
|
+
module Core
|
6
|
+
class Fail < NullaryRelation
|
7
|
+
include Singleton
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
super('fail')
|
11
|
+
end
|
12
|
+
|
13
|
+
def unify(aGoal, vars)
|
14
|
+
[]
|
15
|
+
end
|
16
|
+
end # class
|
17
|
+
end # module
|
18
|
+
end # module
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module MiniKraken
|
2
|
+
module Core
|
3
|
+
class Goal
|
4
|
+
attr_reader :relation
|
5
|
+
|
6
|
+
def initialize(aRelation, args)
|
7
|
+
@relation = aRelation
|
8
|
+
end
|
9
|
+
|
10
|
+
def attain(aPublisher, vars)
|
11
|
+
aPublisher.broadcast_entry(self, vars)
|
12
|
+
outcome = relation.unify(self, vars)
|
13
|
+
aPublisher.broadcast_exit(self, vars, outcome)
|
14
|
+
outcome
|
15
|
+
end
|
16
|
+
end # class
|
17
|
+
end # module
|
18
|
+
end # module
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module MiniKraken
|
2
|
+
module Core
|
3
|
+
class Publisher
|
4
|
+
attr_reader :subscribers
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@subscribers = []
|
8
|
+
end
|
9
|
+
|
10
|
+
def subscribe(aListener)
|
11
|
+
@subscribers << aListener
|
12
|
+
end
|
13
|
+
|
14
|
+
def broadcast_entry(aGoal, variables)
|
15
|
+
subscribers.each do |subscr|
|
16
|
+
subscr.on_entry(aGoal, variables)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def broadcast_exit(aGoal, variables, outcome)
|
21
|
+
subscribers.each do |subscr|
|
22
|
+
subscr.on_exit(aGoal, variables, outcome)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end # class
|
26
|
+
end # module
|
27
|
+
end # module
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module MiniKraken
|
2
|
+
module Core
|
3
|
+
class RunStarExpression
|
4
|
+
attr_reader :vars
|
5
|
+
attr_reader :goal
|
6
|
+
|
7
|
+
def initialize(theVariables, aGoal)
|
8
|
+
@vars = validated_vars(theVariables)
|
9
|
+
@goal = aGoal
|
10
|
+
end
|
11
|
+
|
12
|
+
def run(aPublisher)
|
13
|
+
goal.attain(aPublisher, vars)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def validated_vars(theVariables)
|
19
|
+
variables = {}
|
20
|
+
case theVariables
|
21
|
+
when Variable
|
22
|
+
variables[theVariables.name] = theVariables
|
23
|
+
|
24
|
+
when Array
|
25
|
+
theVariables.each { |v| variables[v.name] = v }
|
26
|
+
else
|
27
|
+
raise StandardError, "Invalid argument #{p theVariables}"
|
28
|
+
end
|
29
|
+
|
30
|
+
variables
|
31
|
+
end
|
32
|
+
end # class
|
33
|
+
end # module
|
34
|
+
end # module
|
data/mini_kraken.gemspec
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "mini_kraken/version"
|
4
|
+
|
5
|
+
# Implementation module
|
6
|
+
module PkgExtending
|
7
|
+
def self.pkg_files(aPackage)
|
8
|
+
file_list = Dir[
|
9
|
+
'.rspec',
|
10
|
+
'.travis.yml',
|
11
|
+
'Gemfile',
|
12
|
+
'Rakefile',
|
13
|
+
'CHANGELOG.md',
|
14
|
+
'LICENSE.txt',
|
15
|
+
'README.md',
|
16
|
+
'mini_kraken.gemspec',
|
17
|
+
'bin/*.rb',
|
18
|
+
'lib/*.*',
|
19
|
+
'lib/**/*.rb',
|
20
|
+
'spec/**/*.rb'
|
21
|
+
]
|
22
|
+
aPackage.files = file_list
|
23
|
+
aPackage.test_files = Dir['spec/**/*_spec.rb']
|
24
|
+
aPackage.require_path = 'lib'
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.pkg_documentation(aPackage)
|
28
|
+
aPackage.rdoc_options << '--charset=UTF-8 --exclude="examples|spec"'
|
29
|
+
aPackage.extra_rdoc_files = ['README.md']
|
30
|
+
end
|
31
|
+
end # module
|
32
|
+
|
33
|
+
Gem::Specification.new do |spec|
|
34
|
+
spec.name = "mini_kraken"
|
35
|
+
spec.version = MiniKraken::VERSION
|
36
|
+
spec.authors = ['Dimitri Geshef']
|
37
|
+
spec.email = ['famished.tiger@yahoo.com']
|
38
|
+
|
39
|
+
spec.summary = %q{Implementation of Minikanren language in Ruby. WIP}
|
40
|
+
spec.description = %q{Implementation of Minikanren language in Ruby. WIP}
|
41
|
+
spec.homepage = "https://github.com/famished-tiger/mini_kraken"
|
42
|
+
spec.license = "MIT"
|
43
|
+
|
44
|
+
# Specify which files should be added to the gem when it is released.
|
45
|
+
spec.bindir = "exe"
|
46
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
47
|
+
spec.require_paths = ["lib"]
|
48
|
+
|
49
|
+
PkgExtending.pkg_files(spec)
|
50
|
+
PkgExtending.pkg_documentation(spec)
|
51
|
+
|
52
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
53
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
54
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
55
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../spec_helper' # Use the RSpec framework
|
4
|
+
|
5
|
+
require_relative '../../lib/mini_kraken/core/fail'
|
6
|
+
require_relative '../../lib/mini_kraken/core/goal'
|
7
|
+
require_relative '../../lib/mini_kraken/core/publisher'
|
8
|
+
require_relative '../../lib/mini_kraken/dsl/kraken_dsl'
|
9
|
+
# Load the class under test
|
10
|
+
require_relative '../../lib/mini_kraken/core/facade'
|
11
|
+
|
12
|
+
module MiniKraken
|
13
|
+
module Core
|
14
|
+
describe Facade do
|
15
|
+
include DSL::KrakenDSL
|
16
|
+
|
17
|
+
let(:a_pub) { Publisher.new }
|
18
|
+
let(:a_relation) { Fail.instance }
|
19
|
+
subject { Facade.new(a_pub) }
|
20
|
+
|
21
|
+
context 'Initialization:' do
|
22
|
+
it 'could have one publisher argument' do
|
23
|
+
expect { Facade.new(a_pub) }.not_to raise_error
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should know its publisher' do
|
27
|
+
expect(subject.publisher).to eq(a_pub)
|
28
|
+
end
|
29
|
+
end # context
|
30
|
+
|
31
|
+
context 'Provided services:' do
|
32
|
+
it 'should support run* expression' do
|
33
|
+
expect(subject.run_star('q', fail)).to be_empty
|
34
|
+
end
|
35
|
+
end # context
|
36
|
+
end # describe
|
37
|
+
end # module
|
38
|
+
end # module
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../spec_helper' # Use the RSpec framework
|
4
|
+
|
5
|
+
# Load the class under test
|
6
|
+
require_relative '../../lib/mini_kraken/core/fail'
|
7
|
+
|
8
|
+
module MiniKraken
|
9
|
+
module Core
|
10
|
+
describe Fail do
|
11
|
+
subject { Fail.instance }
|
12
|
+
|
13
|
+
context 'Initialization:' do
|
14
|
+
it 'should have one instance' do
|
15
|
+
expect { Fail.instance }.not_to raise_error
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should know its name' do
|
19
|
+
expect(subject.name).to eq('fail')
|
20
|
+
end
|
21
|
+
end # context
|
22
|
+
|
23
|
+
context 'Provided services:' do
|
24
|
+
end # context
|
25
|
+
end # describe
|
26
|
+
end # module
|
27
|
+
end # module
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../spec_helper' # Use the RSpec framework
|
4
|
+
require_relative '../../lib/mini_kraken/core/fail'
|
5
|
+
|
6
|
+
# Load the class under test
|
7
|
+
require_relative '../../lib/mini_kraken/core/goal'
|
8
|
+
|
9
|
+
module MiniKraken
|
10
|
+
module Core
|
11
|
+
describe Goal do
|
12
|
+
let(:a_relation) { Fail.instance }
|
13
|
+
subject { Goal.new(a_relation, []) }
|
14
|
+
|
15
|
+
context 'Initialization:' do
|
16
|
+
it 'should accept one goal and argument array' do
|
17
|
+
expect { Goal.new(a_relation, []) }.not_to raise_error
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should know its relation' do
|
21
|
+
expect(subject.relation).to eq(a_relation)
|
22
|
+
end
|
23
|
+
end # context
|
24
|
+
|
25
|
+
context 'Provided services:' do
|
26
|
+
it 'should attain its intended purpose' do
|
27
|
+
pub = double('fake-publisher')
|
28
|
+
expect(pub).to receive(:broadcast_entry).with(subject, [])
|
29
|
+
expect(pub).to receive(:broadcast_exit).with(subject, [], [])
|
30
|
+
expect(subject.attain(pub, [])).to eq([])
|
31
|
+
end
|
32
|
+
end # context
|
33
|
+
end # describe
|
34
|
+
end # module
|
35
|
+
end # module
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../spec_helper' # Use the RSpec framework
|
4
|
+
|
5
|
+
require_relative '../../lib/mini_kraken/core/variable'
|
6
|
+
require_relative '../../lib/mini_kraken/core/fail'
|
7
|
+
require_relative '../../lib/mini_kraken/core/goal'
|
8
|
+
# Load the class under test
|
9
|
+
require_relative '../../lib/mini_kraken/core/run_star_expression'
|
10
|
+
|
11
|
+
module MiniKraken
|
12
|
+
module Core
|
13
|
+
describe RunStarExpression do
|
14
|
+
let(:a_var) { Variable.new('q') }
|
15
|
+
let(:a_relation) { Fail.instance }
|
16
|
+
let(:a_goal) { Goal.new(a_relation, []) }
|
17
|
+
subject { RunStarExpression.new(a_var, a_goal) }
|
18
|
+
|
19
|
+
context 'Initialization:' do
|
20
|
+
it 'could have one variable and a goal' do
|
21
|
+
expect { RunStarExpression.new(a_var, a_goal) }.not_to raise_error
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should know its variables' do
|
25
|
+
expect(subject.vars['q']).to eq(a_var)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should know its goal' do
|
29
|
+
expect(subject.goal).to eq(a_goal)
|
30
|
+
end
|
31
|
+
end # context
|
32
|
+
|
33
|
+
context 'Provided services:' do
|
34
|
+
it 'should unify the variable(s) with the given goal' do
|
35
|
+
pub = double('fake-publisher')
|
36
|
+
expect(pub).to receive(:broadcast_entry).with(a_goal, subject.vars)
|
37
|
+
expect(pub).to receive(:broadcast_exit).with(a_goal, subject.vars, [])
|
38
|
+
expect(subject.run(pub)).to be_empty
|
39
|
+
end
|
40
|
+
end # context
|
41
|
+
end # describe
|
42
|
+
end # module
|
43
|
+
end # module
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../spec_helper' # Use the RSpec framework
|
4
|
+
|
5
|
+
# Load the class under test
|
6
|
+
require_relative '../../lib/mini_kraken/core/variable'
|
7
|
+
|
8
|
+
module MiniKraken
|
9
|
+
module Core
|
10
|
+
describe Variable do
|
11
|
+
subject { Variable.new('q') }
|
12
|
+
|
13
|
+
context 'Initialization:' do
|
14
|
+
it 'should be initialized with a name' do
|
15
|
+
expect { Variable.new('q') }.not_to raise_error
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should know its name' do
|
19
|
+
expect(subject.name).to eq('q')
|
20
|
+
end
|
21
|
+
end # context
|
22
|
+
|
23
|
+
context 'Provided services:' do
|
24
|
+
end # context
|
25
|
+
end # describe
|
26
|
+
end # module
|
27
|
+
end # module
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../spec_helper' # Use the RSpec framework
|
4
|
+
|
5
|
+
# Load the class under test
|
6
|
+
require_relative '../../lib/mini_kraken/dsl/kraken_dsl'
|
7
|
+
|
8
|
+
module MiniKraken
|
9
|
+
module DSL
|
10
|
+
describe KrakenDSL do
|
11
|
+
subject do
|
12
|
+
obj = Object.new
|
13
|
+
obj.extend(KrakenDSL)
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'Attaching mix-in:' do
|
17
|
+
it 'should extend object' do
|
18
|
+
obj = Object.new
|
19
|
+
expect { obj.extend(KrakenDSL) }.not_to raise_error
|
20
|
+
end
|
21
|
+
end # context
|
22
|
+
|
23
|
+
context 'Provided services:' do
|
24
|
+
it "should provide the 'fail' goal constructor" do
|
25
|
+
expect(subject.fail).to be_kind_of(Core::Goal)
|
26
|
+
expect(subject.fail.relation.name).to eq('fail')
|
27
|
+
end
|
28
|
+
end # context
|
29
|
+
end # describe
|
30
|
+
end # module
|
31
|
+
end # module
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'rspec' # Use the RSpec framework
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
# Enable flags like --only-failures and --next-failure
|
6
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
7
|
+
|
8
|
+
config.expect_with :rspec do |c|
|
9
|
+
# Disable the `should` syntax
|
10
|
+
c.syntax = :expect
|
11
|
+
end
|
12
|
+
|
13
|
+
# Display stack trace in case of failure
|
14
|
+
config.full_backtrace = true
|
15
|
+
end
|
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.
|
4
|
+
version: 0.1.01
|
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-
|
11
|
+
date: 2020-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,19 +52,50 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description:
|
55
|
+
description: Implementation of Minikanren language in Ruby. WIP
|
56
56
|
email:
|
57
57
|
- famished.tiger@yahoo.com
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
|
-
extra_rdoc_files:
|
61
|
-
|
60
|
+
extra_rdoc_files:
|
61
|
+
- README.md
|
62
|
+
files:
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- CHANGELOG.md
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- lib/mini_kraken.rb
|
71
|
+
- lib/mini_kraken/core/facade.rb
|
72
|
+
- lib/mini_kraken/core/fail.rb
|
73
|
+
- lib/mini_kraken/core/formal_arg.rb
|
74
|
+
- lib/mini_kraken/core/goal.rb
|
75
|
+
- lib/mini_kraken/core/nullary_relation.rb
|
76
|
+
- lib/mini_kraken/core/publisher.rb
|
77
|
+
- lib/mini_kraken/core/relation.rb
|
78
|
+
- lib/mini_kraken/core/run_star_expression.rb
|
79
|
+
- lib/mini_kraken/core/succeed.rb
|
80
|
+
- lib/mini_kraken/core/variable.rb
|
81
|
+
- lib/mini_kraken/dsl/kraken_dsl.rb
|
82
|
+
- lib/mini_kraken/version.rb
|
83
|
+
- mini_kraken.gemspec
|
84
|
+
- spec/core/facade_spec.rb
|
85
|
+
- spec/core/fail_spec.rb
|
86
|
+
- spec/core/goal_spec.rb
|
87
|
+
- spec/core/run_star_expression_spec.rb
|
88
|
+
- spec/core/variable_spec.rb
|
89
|
+
- spec/dsl/kraken_dsl_spec.rb
|
90
|
+
- spec/mini_kraken_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
62
92
|
homepage: https://github.com/famished-tiger/mini_kraken
|
63
93
|
licenses:
|
64
94
|
- MIT
|
65
95
|
metadata: {}
|
66
96
|
post_install_message:
|
67
|
-
rdoc_options:
|
97
|
+
rdoc_options:
|
98
|
+
- --charset=UTF-8 --exclude="examples|spec"
|
68
99
|
require_paths:
|
69
100
|
- lib
|
70
101
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -81,5 +112,12 @@ requirements: []
|
|
81
112
|
rubygems_version: 3.0.3
|
82
113
|
signing_key:
|
83
114
|
specification_version: 4
|
84
|
-
summary:
|
85
|
-
test_files:
|
115
|
+
summary: Implementation of Minikanren language in Ruby. WIP
|
116
|
+
test_files:
|
117
|
+
- spec/core/facade_spec.rb
|
118
|
+
- spec/core/fail_spec.rb
|
119
|
+
- spec/core/goal_spec.rb
|
120
|
+
- spec/core/run_star_expression_spec.rb
|
121
|
+
- spec/core/variable_spec.rb
|
122
|
+
- spec/dsl/kraken_dsl_spec.rb
|
123
|
+
- spec/mini_kraken_spec.rb
|