class Axiom::Algebra::Difference

The difference between relations

Public Instance Methods

delete(other) click to toggle source

Delete a relation from the Difference

Remove the relation from the left operand, and add it to the right operand so that it is removed by the difference operation.

@example

new_relation = difference.delete(other)

@param [Relation] other

@return [Difference]

@api public

# File lib/axiom/algebra/difference.rb, line 60
def delete(other)
  left.delete(coerce(other).difference(right)).difference(right)
end
each() { |tuple| ... } click to toggle source

Iterate over each tuple in the set

@example

difference = Difference.new(left, right)
difference.each { |tuple| ... }

@yield [tuple]

@yieldparam [Tuple] tuple

each tuple in the set

@return [self]

@api public

# File lib/axiom/algebra/difference.rb, line 24
def each
  return to_enum unless block_given?
  left.each { |tuple| yield tuple unless right.include?(tuple) }
  self
end
insert(other) click to toggle source

Insert a relation into the Difference

Add the relation to the left operand, and remove from the right operand so that it not removed by the difference operation.

@example

new_relation = difference.insert(other)

@param [Relation] other

@return [Difference]

@api public

# File lib/axiom/algebra/difference.rb, line 43
def insert(other)
  left.insert(coerce(other).difference(right)).difference(right)
end