Sha256: 5d080bd458f1093b59279a1b3a6e720a00ecaa3897efceb8a96e382b9201a580
Contents?: true
Size: 1009 Bytes
Versions: 2
Compression:
Stored size: 1009 Bytes
Contents
require_relative '../core/any_value' require_relative '../core/cons_cell' require_relative 'fresh_env' module MiniKraken module Glue class RunStarExpression attr_reader :env # @param var_name [String] # @param goal [Core::Goal] def initialize(var_name, goal) @env = FreshEnv.new([var_name], goal) end def var env.vars.values.first end def run result = nil solver = env.goal.attain(env) # require 'debug' loop do outcome = solver.resume break if outcome.nil? env.clear if result # ... more than one result... else if outcome.successful? env.propagate(outcome) # require 'debug' result = Core::ConsCell.new(var.quote(outcome)) else result = Core::NullList end end end result end end # class end # module end # module
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mini_kraken-0.1.04 | lib/mini_kraken/glue/run_star_expression.rb |
mini_kraken-0.1.03 | lib/mini_kraken/glue/run_star_expression.rb |