Sha256: 96e9c65b23eb48d5c8377652a7bc272276ad7b37ba075084a4bbc336507996b4
Contents?: true
Size: 928 Bytes
Versions: 2
Compression:
Stored size: 928 Bytes
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 self if other.right.literal? end super 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? { left.name => right.value } elsif right.identifier? && left.literal? { 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
predicate-2.2.0 | lib/predicate/nodes/eq.rb |
predicate-2.1.0 | lib/predicate/nodes/eq.rb |