Sha256: 0bd6dcf735a54ec577e5336c7d6d3d1f21143c39b0f97a776c92ee5d845abeea

Contents?: true

Size: 715 Bytes

Versions: 1

Compression:

Stored size: 715 Bytes

Contents

module Dydx
  module Algebra
    module Operator
      module Parts
        module General
          def +(x)
            if x.is_0?
              self
            elsif inverse?(x, :+)
              e0
            else
              super(x)
            end
          end

          def *(x)
            if x.is_0?
              x
            elsif x.is_1?
              self
            elsif inverse?(x, :*)
              e1
            else
              super(x)
            end
          end

          def ^(x)
            if x.is_0?
              _(1)
            elsif x.is_1?
              self
            else
              super(x)
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dydx-0.0.5 lib/dydx/algebra/operator/parts/general.rb