class Bud::PositiveSetLattice
A set that admits only non-negative numbers. This allows “sum” to be a monotone function. Note that this does duplicate elimination on its input, so it actually computes “SUM(DISTINCT …)” in SQL.
XXX: for methods that take a user-provided code block, we need to ensure that the set continues to contain only positive numbers.
Public Class Methods
new(i=[])
click to toggle source
Calls superclass method
Bud::SetLattice::new
# File lib/bud/lattice-lib.rb, line 353 def initialize(i=[]) super @v.each do |n| reject_input(i) unless n.class <= Numeric reject_input(i) if n < 0 end end