Skip to content

Commit

Permalink
fixing bug in "is" handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Preston Lee committed Feb 9, 2009
1 parent 99de443 commit 88b4282
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions Manifest
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
examples/acls.rb
examples/hanoi.rb
History.txt
lib/ruby-prolog/ruby-prolog.rb
lib/ruby-prolog.rb
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Echoe.new("ruby-prolog") do |p|
p.url = "http://www.openrain.com.com"
# p.docs_host = "uncapitalizer.com:~/www/files/doc/"
# p.runtime_dependencies = ["string_tools >=1.4.0"]
p.version = '0.0.4'
p.version = '0.0.5'
p.email = "preston.lee@openrain.com"
end
2 changes: 1 addition & 1 deletion lib/ruby-prolog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
module RubyProlog

# :stopdoc:
VERSION = '0.0.4'
VERSION = '0.0.5'
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
# :startdoc:
Expand Down
9 changes: 5 additions & 4 deletions lib/ruby-prolog/ruby-prolog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,17 @@ def [](t)

class CallbackEnvironment

def initialize(env, trail)
@env, @trail = env, trail
def initialize(env, trail, core)
@env, @trail, @core = env, trail, core
end

def [](t)
return @env[t]
end

def unify(t, u)
return _unify(t, @env, u, @env, @trail, @env)
# pp "CORE " + @core
return @core._unify(t, @env, u, @env, @trail, @env)
end

end
Expand Down Expand Up @@ -233,7 +234,7 @@ def _resolve_body(body, env, cut)
trail = []
if _unify_(goal, env, d_head, d_env, trail, d_env)
if Proc === d_body
if d_body[CallbackEnvironment.new(d_env, trail)]
if d_body[CallbackEnvironment.new(d_env, trail, self)]
_resolve_body(rest, env, cut) {
yield
}
Expand Down

0 comments on commit 88b4282

Please sign in to comment.