rubylog 0.0.1 → 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 (122) hide show
  1. data/Gemfile +1 -1
  2. data/README.hu.rb +58 -0
  3. data/README.rdoc +248 -89
  4. data/Rakefile +6 -1
  5. data/VERSION +1 -1
  6. data/bin/rubylog +18 -0
  7. data/examples/dcg.rb +35 -0
  8. data/examples/dcg2.rb +42 -0
  9. data/examples/enumerators.rb +30 -0
  10. data/examples/factorial.rb +9 -8
  11. data/examples/hanoi.rb +24 -0
  12. data/examples/hello.rb +11 -5
  13. data/examples/parsing.rb +27 -0
  14. data/examples/primitives.rb +24 -0
  15. data/examples/theory.rb +22 -10
  16. data/lib/rubylog/builtins/default.rb +10 -0
  17. data/lib/rubylog/builtins/file_system.rb +15 -0
  18. data/lib/rubylog/builtins/logic.rb +109 -0
  19. data/lib/rubylog/builtins/reflection.rb +94 -0
  20. data/lib/rubylog/builtins/term.rb +47 -0
  21. data/lib/rubylog/dsl/array_splat.rb +25 -0
  22. data/lib/rubylog/dsl/primitives.rb +17 -0
  23. data/lib/rubylog/dsl/thats.rb +22 -0
  24. data/lib/rubylog/dsl/variables.rb +30 -0
  25. data/lib/rubylog/dsl.rb +35 -17
  26. data/lib/rubylog/errors.rb +19 -1
  27. data/lib/rubylog/interfaces/assertable.rb +16 -0
  28. data/lib/rubylog/interfaces/callable.rb +18 -0
  29. data/lib/rubylog/interfaces/composite_term.rb +47 -0
  30. data/lib/rubylog/interfaces/predicate.rb +8 -0
  31. data/lib/rubylog/interfaces/procedure.rb +60 -0
  32. data/lib/rubylog/interfaces/term.rb +41 -0
  33. data/lib/rubylog/mixins/array.rb +118 -0
  34. data/lib/{class.rb → rubylog/mixins/class.rb} +2 -2
  35. data/lib/rubylog/mixins/hash.rb +8 -0
  36. data/lib/rubylog/mixins/kernel.rb +5 -0
  37. data/lib/rubylog/mixins/method.rb +3 -0
  38. data/lib/rubylog/mixins/object.rb +8 -0
  39. data/lib/rubylog/mixins/proc.rb +37 -0
  40. data/lib/rubylog/mixins/string.rb +104 -0
  41. data/lib/rubylog/mixins/symbol.rb +44 -0
  42. data/lib/rubylog/simple_procedure.rb +8 -0
  43. data/lib/rubylog/{clause.rb → structure.rb} +32 -31
  44. data/lib/rubylog/theory.rb +368 -79
  45. data/lib/rubylog/variable.rb +102 -23
  46. data/lib/rubylog.rb +33 -25
  47. data/logic/builtins/file_system_logic.rb +23 -0
  48. data/logic/builtins/reflection_logic.rb +40 -0
  49. data/logic/dereference_logic.rb +23 -0
  50. data/logic/directory_structure_logic.rb +19 -0
  51. data/logic/dsl_logic.rb +29 -0
  52. data/logic/errors_logic.rb +9 -0
  53. data/logic/guard_logic.rb +115 -0
  54. data/logic/list_logic.rb +55 -0
  55. data/logic/map_logic.rb +15 -0
  56. data/logic/multitheory.rb +23 -0
  57. data/logic/recursion_logic.rb +12 -0
  58. data/logic/string_logic.rb +41 -0
  59. data/logic/thats_logic.rb +51 -0
  60. data/logic/variable_logic.rb +24 -0
  61. data/rubylog.gemspec +85 -46
  62. data/spec/bartak_guide_spec.rb +57 -62
  63. data/spec/builtins/all_spec.rb +99 -0
  64. data/spec/builtins/and_spec.rb +22 -0
  65. data/spec/builtins/array_spec.rb +16 -0
  66. data/spec/builtins/branch_or_spec.rb +27 -0
  67. data/spec/builtins/cut_spec.rb +44 -0
  68. data/spec/builtins/fail_spec.rb +5 -0
  69. data/spec/builtins/false_spec.rb +5 -0
  70. data/spec/builtins/in_spec.rb +38 -0
  71. data/spec/builtins/is_false_spec.rb +12 -0
  72. data/spec/builtins/is_spec.rb +26 -0
  73. data/spec/builtins/matches_spec.rb +23 -0
  74. data/spec/builtins/or_spec.rb +22 -0
  75. data/spec/{rubylog/builtins → builtins}/splits_to.rb +0 -0
  76. data/spec/builtins/then_spec.rb +27 -0
  77. data/spec/builtins/true_spec.rb +5 -0
  78. data/spec/clause_spec.rb +82 -0
  79. data/spec/compilation_spec.rb +61 -0
  80. data/spec/custom_classes_spec.rb +43 -0
  81. data/spec/dereference.rb +10 -0
  82. data/spec/{inriasuite.rb → inriasuite_spec.rb} +2 -9
  83. data/spec/queries_spec.rb +150 -0
  84. data/spec/recursion_spec.rb +4 -4
  85. data/spec/ruby_code_spec.rb +52 -0
  86. data/spec/rules_spec.rb +97 -0
  87. data/spec/spec_helper.rb +6 -2
  88. data/spec/theory_spec.rb +28 -0
  89. data/spec/unification_spec.rb +84 -0
  90. data/spec/variable_spec.rb +26 -0
  91. metadata +153 -180
  92. data/examples/4queens.rb +0 -10
  93. data/examples/calculation.rb +0 -12
  94. data/examples/concepts.rb +0 -46
  95. data/examples/fp.rb +0 -56
  96. data/examples/historia_de_espana.rb +0 -31
  97. data/examples/idea.rb +0 -143
  98. data/examples/lists.rb +0 -5
  99. data/examples/mechanika.rb +0 -409
  100. data/examples/parse.rb +0 -15
  101. data/lib/array.rb +0 -24
  102. data/lib/method.rb +0 -4
  103. data/lib/object.rb +0 -5
  104. data/lib/proc.rb +0 -4
  105. data/lib/rubylog/builtins.rb +0 -193
  106. data/lib/rubylog/callable.rb +0 -20
  107. data/lib/rubylog/composite_term.rb +0 -38
  108. data/lib/rubylog/dsl/constants.rb +0 -15
  109. data/lib/rubylog/dsl/first_order_functors.rb +0 -9
  110. data/lib/rubylog/dsl/global_functors.rb +0 -3
  111. data/lib/rubylog/dsl/second_order_functors.rb +0 -8
  112. data/lib/rubylog/internal_helpers.rb +0 -16
  113. data/lib/rubylog/predicate.rb +0 -34
  114. data/lib/rubylog/proc_method_additions.rb +0 -69
  115. data/lib/rubylog/term.rb +0 -20
  116. data/lib/rubylog/unifiable.rb +0 -19
  117. data/lib/symbol.rb +0 -35
  118. data/script/inriasuite2spec +0 -0
  119. data/script/inriasuite2spec.pl +0 -22
  120. data/spec/rubylog/clause_spec.rb +0 -81
  121. data/spec/rubylog/variable_spec.rb +0 -25
  122. data/spec/rubylog_spec.rb +0 -914
@@ -1,193 +0,0 @@
1
- module Rubylog
2
- BUILTINS = Hash.new{|h,k| h[k] = {}}
3
-
4
- class << Object.new
5
- def singleton_method_added name
6
- unless name == :singleton_method_added
7
- m = method(name)
8
- BUILTINS[name][m.arity] = m
9
- end
10
- end
11
-
12
-
13
- # prolog builtins
14
-
15
- def true
16
- yield
17
- end
18
-
19
- def fail
20
- end
21
-
22
- def and a, b
23
- a.prove { b.prove { yield } }
24
- end
25
-
26
- def cut
27
- yield
28
- raise Cut
29
- end
30
-
31
- def or a, b
32
- a.prove { yield }
33
- b.prove { yield }
34
- end
35
-
36
- def then a,b
37
- stands = false
38
- a.prove { stands = true ; break }
39
- b.prove { yield } if stands
40
- end
41
-
42
- def is_false a
43
- a.prove { return }
44
- yield
45
- end
46
-
47
- def repeat # XXX not tested
48
- yield while true
49
- end
50
-
51
- # unification
52
-
53
- def is a,b
54
- a = a.rubylog_resolve_function
55
- b = b.rubylog_resolve_function
56
- a.rubylog_unify(b) { yield }
57
- end
58
-
59
-
60
-
61
- def matches a,b
62
- a = a.rubylog_resolve_function
63
- b = b.rubylog_resolve_function
64
- yield if b.rubylog_dereference === a.rubylog_dereference
65
- end
66
-
67
- def splits_to a,h,t
68
- t = t.rubylog_dereference
69
- if t.instance_of? Rubylog::Variable
70
- a = a.rubylog_dereference
71
- if a.instance_of? Rubylog::Variable
72
- InternalHelpers.non_empty_list {|l|
73
- t.rubylog_unify(l.drop 1) {
74
- h.rubylog_unify(l[0]) {
75
- a.rubylog_unify(l) {
76
- yield
77
- }
78
- }
79
- }
80
- }
81
- elsif a.instance_of? Array
82
- if a.size > 0
83
- h.rubylog_unify(a.first) { t.rubylog_unify(a.drop 1) { yield } }
84
- end
85
- end
86
- elsif t.instance_of? Array
87
- a.rubylog_unify([h]+t) { yield }
88
- end
89
- end
90
-
91
- def in a,b
92
- a = a.rubylog_resolve_function
93
- b = b.rubylog_resolve_function.rubylog_dereference
94
- if b.instance_of? Rubylog::Variable # XXX not tested
95
- InternalHelpers.non_empty_list {|l|
96
- a.rubylog_unify(l[-1]) {
97
- b.rubylog_unify(l) {
98
- yield
99
- }
100
- }
101
- }
102
- else
103
- b.each do |e|
104
- a.rubylog_unify(e) { yield }
105
- end
106
- end
107
- end
108
-
109
- def _p a
110
- p a.rubylog_deep_dereference
111
- yield
112
- end
113
-
114
- def _puts a
115
- puts a.rubylog_deep_dereference
116
- yield
117
- end
118
-
119
- def _print a
120
- print a.rubylog_deep_dereference
121
- yield
122
- end
123
-
124
- def nl
125
- puts
126
- yield
127
- end
128
-
129
- def all a,b
130
- a.prove {
131
- stands = false;
132
- b.prove { stands = true; break }
133
- return if not stands
134
- }
135
- yield
136
- end
137
-
138
- def any a,b
139
- a.prove { b.prove { yield; return } }
140
- end
141
-
142
- def one a,b
143
- stands = false
144
- a.prove {
145
- b.prove {
146
- return if stands
147
- stands = true
148
- }
149
- }
150
- yield if stands
151
- end
152
-
153
- def none a,b
154
- a.prove { b.prove { return } }
155
- yield
156
- end
157
-
158
- def all a
159
- a.prove { }
160
- yield
161
- end
162
-
163
- def any a
164
- a.prove { yield; return }
165
- end
166
-
167
- def one a
168
- stands = false
169
- a.prove {
170
- return if stands
171
- stands = true
172
- }
173
- yield if stands
174
- end
175
-
176
-
177
- end
178
-
179
-
180
- # aliases
181
- BUILTINS[:&][2] = BUILTINS[:and][2]
182
- BUILTINS[:|][2] = BUILTINS[:or][2]
183
- BUILTINS[:~][1] =
184
- BUILTINS[:not][1] =
185
- BUILTINS[:none][1] =
186
- BUILTINS[:fails][1] = BUILTINS[:is_false][1]
187
- BUILTINS[:false][0] = BUILTINS[:fail][0]
188
-
189
- DSL.add_first_order_functor :is, :matches, :in, :_p, :_puts, :_print
190
- DSL.add_second_order_functor :and, :or, :then, :is_false, :&, :|, :~, :not, :all, :any, :one, :none, :fails
191
- DSL.add_functors_to Array, :splits_to
192
-
193
- end
@@ -1,20 +0,0 @@
1
- module Rubylog
2
- module Callable
3
- # should yield for each possible solution of the term
4
- #def prove
5
- # raise "abstract method called"
6
- #end
7
-
8
- def true?
9
- Rubylog.theory.true? self
10
- end
11
-
12
- def solve
13
- if block_given?
14
- Rubylog.theory.solve(self) {|*a| yield *a}
15
- else
16
- Rubylog.theory.solve(self) {|*a|}
17
- end
18
- end
19
- end
20
- end
@@ -1,38 +0,0 @@
1
- module Rubylog
2
- module CompositeTerm
3
- def rubylog_compile_variables
4
- vars = []; vars_by_name = {}
5
- rubylog_clone do |i|
6
- if i.is_a? Rubylog::Variable
7
- if i.dont_care?
8
- i = i.dup
9
- else
10
- i = vars_by_name[i.name] || begin
11
- r = i.dup
12
- vars << r
13
- vars_by_name[i.name] = r
14
- end
15
- end
16
- elsif i.is_a? Rubylog::CompositeTerm
17
- i.instance_variable_set :"@rubylog_variables", vars
18
- end
19
- i
20
- end
21
- end
22
-
23
- def rubylog_deep_dereference
24
- rubylog_clone do |i|
25
- i.rubylog_deep_dereference
26
- end
27
- end
28
-
29
- attr_reader :rubylog_variables
30
-
31
-
32
- # should return a deep copy of the term, atomic terms treated as
33
- # leaves, with &block called post-order
34
- #def rubylog_clone &block
35
- #block.call self.class.new attr1.rubylog_clone &block
36
- #end
37
- end
38
- end
@@ -1,15 +0,0 @@
1
- module Rubylog
2
- module DSL
3
- module Constants
4
- def self.included class_or_module
5
- class_or_module.extend ClassMethods
6
- end
7
-
8
- module ClassMethods
9
- def const_missing c
10
- Rubylog::Variable.new c
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,9 +0,0 @@
1
- module Rubylog
2
- module DSL
3
- module FirstOrderFunctors
4
- # see rubylog/builtins.rb
5
- end
6
- end
7
- end
8
-
9
-
@@ -1,3 +0,0 @@
1
- module Rubylog::DSL::GlobalFunctors
2
-
3
- end
@@ -1,8 +0,0 @@
1
- module Rubylog
2
- module DSL
3
- module SecondOrderFunctors
4
- # see rubylog/builtins.rb
5
- end
6
- end
7
- end
8
-
@@ -1,16 +0,0 @@
1
- module Rubylog::InternalHelpers
2
- class << self
3
- def non_empty_list
4
- l = []
5
- while true do
6
- l << Rubylog::Variable.new(:_)
7
- yield l
8
- end
9
- end
10
-
11
- def vars_hash_of o
12
- vars = o.rubylog_variables
13
- Hash[vars.zip(vars.map{|v|v.value})]
14
- end
15
- end
16
- end
@@ -1,34 +0,0 @@
1
-
2
- module Rubylog
3
- class Predicate < Array
4
- # accepts the *args of the called clause
5
- def call *args
6
- begin
7
- each do |rule|
8
- rule = rule.rubylog_compile_variables
9
- head, body = rule[0], rule[1]
10
- head.args.rubylog_unify(args) {
11
- Rubylog.theory.trace 1, head, InternalHelpers.vars_hash_of(head)
12
- body.prove {
13
- yield
14
- }
15
- Rubylog.theory.trace -1
16
- }
17
- end
18
- rescue Cut
19
- end
20
- end
21
-
22
- def discontinuous!
23
- @discontinuous = true
24
- end
25
-
26
- def discontinuous?
27
- @discontinuous
28
- end
29
-
30
- end
31
-
32
-
33
-
34
- end
@@ -1,69 +0,0 @@
1
- module Rubylog
2
- module ProcMethodAdditions
3
-
4
- # Procs and methods are used three ways.
5
- #
6
- # Firstly, as a predicate. A predicate is an object that responds to #call,
7
- # and yields if and the number of times the represented predicate is
8
- # provable. Built-in predicates are implemented this way.
9
- # Example (definition of a new built-in twice):
10
- # def self.twice; yield; yield; end
11
- # theory[:twice][0] = method :twice
12
- #
13
- # Secondly, as a callable term. A callable term is a term that responds to
14
- # #prove, and yields if and the number of times the represented predicate is
15
- # provable. This implementation calls the proc/method with the variables from
16
- # the sentence passed as arguments, and yields once iff the proc/method
17
- # returned true. This permits the use of block instead of a callable term.
18
- # Examples:
19
- # :good_age(A).if {|a|a >= 13}
20
- #
21
- # :greet(N).if female(N).and {|n| puts "Hello, Ms. #{n}"; true }
22
- # :greet(N).if male(N).and {|n| puts "Hello, Mr. #{n}"; true }
23
- #
24
- # Thirdly, as a function. A function is a term that responds to
25
- # #rubylog_resolve_function and does something else than returning self.
26
- # Built-in predicates with two or more arguments, that require a not
27
- # necessarily callable term as their last argument should call
28
- # rubylog_resolve_function on this argument if it responds to it. This
29
- # permits users to use a block instead of the last argument. Examples:
30
- # :greeting(N,G).if female(N).then G.is {|n| "Hello, Ms. #{n}" }
31
- # :greeting(N,G).if male(N).then G.is {|n| "Hello, Mr. #{n}" }
32
- #
33
-
34
-
35
- def self.included class_or_module
36
- class_or_module.send :include, Rubylog::Callable
37
-
38
- # procs and methods are composite terms, just to simply get
39
- # access to variables
40
- class_or_module.send :include, Rubylog::CompositeTerm
41
- end
42
-
43
- # Callable methods
44
- def prove
45
- yield if call_with_rubylog_variables
46
- end
47
-
48
-
49
- def call_with_rubylog_variables
50
- raise Rubylog::InvalidStateError, "variables not available" if not @rubylog_variables
51
- if arity == -1
52
- call *@rubylog_variables.map{|v|v.value}
53
- else
54
- call *@rubylog_variables[0...arity].map{|v|v.value}
55
- end
56
- end
57
-
58
- # Term methods
59
- def rubylog_resolve_function
60
- call_with_rubylog_variables
61
- end
62
-
63
- # CompositeTerm methods
64
- def rubylog_clone
65
- yield dup
66
- end
67
- end
68
- end
69
-
data/lib/rubylog/term.rb DELETED
@@ -1,20 +0,0 @@
1
- module Rubylog
2
- module Term
3
- def rubylog_clone
4
- yield self
5
- end
6
-
7
- def rubylog_variables
8
- []
9
- end
10
-
11
- def rubylog_resolve_function
12
- self
13
- end
14
-
15
-
16
- end
17
-
18
-
19
-
20
- end
@@ -1,19 +0,0 @@
1
- module Rubylog
2
- module Unifiable
3
- def rubylog_unify other
4
- if other.kind_of? Rubylog::Variable
5
- other.rubylog_unify(self) do yield end
6
- else
7
- yield if self == other
8
- end
9
- end
10
-
11
- def rubylog_dereference
12
- self
13
- end
14
-
15
- def rubylog_deep_dereference
16
- self
17
- end
18
- end
19
- end
data/lib/symbol.rb DELETED
@@ -1,35 +0,0 @@
1
- class Symbol
2
-
3
- # a proxy for Clause
4
- def functor
5
- self
6
- end
7
-
8
- def arity
9
- 0
10
- end
11
-
12
- def desc
13
- [self, 0]
14
- end
15
-
16
- def args
17
- []
18
- end
19
-
20
- # Unifiable methods
21
- include Rubylog::Unifiable
22
-
23
- # Callable methods
24
- include Rubylog::Callable
25
-
26
- def prove
27
- predicate = Rubylog.theory[self][0]
28
- raise Rubylog::ExistenceError, desc.inspect if not predicate
29
- predicate.call(*args) { yield }
30
- end
31
-
32
- # Second-order functors (:is_false, :and, :or, :then)
33
- include Rubylog::DSL::SecondOrderFunctors
34
-
35
- end
Binary file
@@ -1,22 +0,0 @@
1
- %:-
2
- %
3
- :- op( 20, xfx, <-- ).
4
-
5
- main :-
6
- open_file,
7
- repeat,
8
- (read([Goal, Result]); halt),
9
- print_assertion(Goal, Result),
10
- fail; true.
11
-
12
-
13
- open_file :-
14
- argument_list([Filename]),
15
- open(Filename, read, S),
16
- set_input(S).
17
-
18
-
19
- print_assertion(Goal, Result) :-
20
- write(Goal), write(Result), nl.
21
-
22
- :- initialization(main).
@@ -1,81 +0,0 @@
1
- require 'rubylog'
2
-
3
- class << Rubylog.theory
4
- describe "clauses" do
5
- it "can be created" do
6
- (:john.is_happy).should be_kind_of Rubylog::Term
7
- (:john.likes :beer).should be_kind_of Rubylog::Term
8
- (A.likes :beer).should be_kind_of Rubylog::Term
9
- (:john.likes Drink).should be_kind_of Rubylog::Term
10
- (:john.likes :drinking.in :bar).should be_kind_of Rubylog::Term
11
- end
12
- it "forbids non-declared names" do
13
- lambda { :john.something_else }.should raise_error(NoMethodError)
14
- end
15
- it "also work with operators" do
16
- (:is_happy%1).should be_kind_of Rubylog::Term
17
- (A%B).should be_kind_of Rubylog::Term
18
- end
19
- it "can be asked for their functor" do
20
- (:john.is_happy).functor.should == :is_happy
21
- (:is_happy%1).functor.should == :%
22
- (A%1).functor.should == :%
23
- (:john.likes :drinking.in :bar).functor.should == :likes
24
- end
25
- it "can be indexed" do
26
- (:john.is_happy)[0].should == :john
27
- (:john.likes :beer)[0].should == :john
28
- (:john.likes :beer)[1].should == :beer
29
- (:john.likes(:cold, :beer))[2].should == :beer
30
- (:john.likes(:cold, :beer))[1..2].should == [:cold,:beer]
31
- (:john.likes :drinking.in :bar)[1].should == (:drinking.in :bar)
32
- end
33
- it "can be asked for their args" do
34
- (:john.is_happy).args.should == [:john]
35
- (:john.likes :beer).args.should == [:john, :beer]
36
- (:john.likes(:cold, :beer)).args.should == [:john, :cold, :beer]
37
- (:john.likes :drinking.in :bar).args.should == [:john, :drinking.in(:bar)]
38
- end
39
- it "support ==" do
40
- (:john.is_happy).should == (:john.is_happy)
41
- (:john.is_happy).should_not be_equal(:john.is_happy)
42
- (:john.is_happy).should_not == nil
43
- (:john.is_happy).should_not == 9
44
- (:john.is_happy).should_not == :john
45
- (:john.is_happy).should_not == Rubylog
46
- (:john.likes :drinking.in :bar).should == (:john.likes :drinking.in :bar)
47
- end
48
- it "support eql?" do
49
- (:john.is_happy).should be_eql(:john.is_happy)
50
- (:john.is_happy).should_not be_eql nil
51
- (:john.is_happy).should_not be_eql 9
52
- (:john.is_happy).should_not be_eql :john
53
- (:john.is_happy).should_not be_eql Rubylog
54
- (:john.likes :drinking.in :bar).should be_eql(:john.likes :drinking.in :bar)
55
- end
56
- it "support hash" do
57
- (:john.is_happy).hash.should == (:john.is_happy).hash
58
- (:john.likes :drinking.in :bar).hash.should ==
59
- (:john.likes :drinking.in :bar).hash
60
- end
61
- it "support inspect" do
62
- (:john.is_happy).inspect.should == ":john.is_happy"
63
- (:john.likes :beer).inspect.should == ":john.likes(:beer)"
64
- (:john.likes :drinking,:beer).inspect.should == ":john.likes(:drinking, :beer)"
65
- (:john.likes :drinking.in :bar).inspect.should == ":john.likes(:drinking.in(:bar))"
66
- end
67
- it "can tell their arity" do
68
- (:john.is_happy).arity.should == 1
69
- (:john.likes :beer).arity.should == 2
70
- (:john.likes :drinking,:beer).arity.should == 3
71
- (:john.likes :drinking.in :bar).arity.should == 2
72
- end
73
- it "can tell their descriptor" do
74
- (:john.is_happy).desc.should == [:is_happy,1]
75
- (:john.likes :beer).desc.should == [:likes,2]
76
- (:john.likes :drinking,:beer).desc.should == [:likes,3]
77
- (:john.likes :drinking.in :bar).desc.should == [:likes,2]
78
- end
79
- end
80
-
81
- end
@@ -1,25 +0,0 @@
1
- require 'rubylog'
2
-
3
- class << Rubylog.theory
4
- describe "variables" do
5
- it "are undefined constants" do
6
- [A, SomethingLong].each{|x|x.should be_kind_of Rubylog::Variable}
7
- end
8
-
9
- it "support ==" do
10
- A.should == A
11
- end
12
-
13
- it "support eql?" do
14
- A.should be_eql A
15
- end
16
-
17
- it "returns different instances" do
18
- A.should_not be_equal A
19
- end
20
-
21
- specify "that start with ANY... are dont care" do
22
- [ANY, ANYTHING, ANYTIME].each{|x|x.should be_kind_of Rubylog::Variable; x.should be_dont_care}
23
- end
24
- end
25
- end