Sha256: 8d6e2caf92130928478a4ef810859fe35a3ab1a433edba895cc52ee569ae6f00
Contents?: true
Size: 1.84 KB
Versions: 1
Compression:
Stored size: 1.84 KB
Contents
# encoding: utf-8 module Axiom class Function class Connective # A logical AND between expressions class Conjunction < Connective include Binary, Binary::Invertible undef_method :inverse # Evaluate the operands using a logical AND # # @example with true operands # Conjunction.call(true, true) # => true # # @example with true and false # Conjunction.call(true, false) # => false # # @example with false and true # Conjunction.call(false, true) # => false # # @example with false and false # Conjunction.call(false, false) # => false # # @param [Boolean] left # @param [Boolean] right # # @return [Boolean] # # @api public def self.call(left, right) left && right end # Return the inverse connective # # @example # disjunction = conjunction.inverse # # @return [Disjunction] # # @api public def inverse Disjunction.new(Negation.new(left), Negation.new(right)). memoize(:inverse, self) end module Methods extend Aliasable inheritable_alias(:& => :and) # Logically AND the expression with another expression # # @example # conjunction = expression.and(other) # # @param [Function] other # # @return [Conjunction] # # @api public def and(other) Conjunction.new(self, other) end end # module Methods Connective.class_eval { include Methods } memoize :inverse end # class Conjunction end # class Connective end # class Function end # module Axiom
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.0 | lib/axiom/function/connective/conjunction.rb |