Sha256: 7e2f394d3f16e975477a2b6b2639aa7e27f3ed48702f0daf53759d2ac2ecfbec
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
class Predicate module Eq include DyadicComp def operator_symbol :== end def &(other) return super unless free_variables == other.free_variables case other when Eq return self if constants == other.constants return contradiction when In return super unless var_against_literal_value? && other.var_against_literal_value? mine, hers = self.right.value, other.right.value return self if hers.include?(mine) contradiction else super end rescue NotSupportedError super end def constant_variables fv = free_variables fv.size == 1 ? fv : [] end def constants left, right = sexpr(self.left), sexpr(self.right) if left.identifier? && right.literal? && !right.has_placeholder? { left.name => right.value } elsif right.identifier? && left.literal? && !left.has_placeholder? { right.name => left.value } else {} end end def dyadic_priority 900 end def evaluate(tuple) left.evaluate(tuple) == right.evaluate(tuple) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
predicate-2.3.3 | lib/predicate/nodes/eq.rb |
predicate-2.3.2 | lib/predicate/nodes/eq.rb |
predicate-2.3.1 | lib/predicate/nodes/eq.rb |