Module: MagicLogic::Operator

Included in:
Base
Defined in:
lib/magic_logic.rb

Instance Method Summary collapse

Instance Method Details

#<=>(q) ⇒ Object



40
41
42
# File 'lib/magic_logic.rb', line 40

def <=>(q)
  (self >= q) * (q >= self)
end

#>=(q) ⇒ Object



36
37
38
# File 'lib/magic_logic.rb', line 36

def >=(q)
  (~self + q)
end

#_(ope, l, r) ⇒ Object



5
6
7
# File 'lib/magic_logic.rb', line 5

def _ ope, l, r
  ope == :+ ? l : r
end

#~@Object



29
30
31
32
33
34
# File 'lib/magic_logic.rb', line 29

def ~@
  if    is_neg?  then p
  elsif is_form? then vars.map(&:~).inject(_ ope, :*, :+)
  else                NEG.new(self)
  end
end