Sha256: 1208b33dab4343b84e175733369881619d5a292038c92baa92eb456e9da68995
Contents?: true
Size: 994 Bytes
Versions: 1
Compression:
Stored size: 994 Bytes
Contents
# frozen_string_literal: true 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... elsif outcome.successful? env.propagate(outcome) # require 'debug' result = Core::ConsCell.new(var.quote(outcome)) else result = Core::NullList end end result end end # class end # module end # module
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mini_kraken-0.1.05 | lib/mini_kraken/glue/run_star_expression.rb |