Entries from 2007-01-30 to 1 day
def product_with(base, *rest, &constraint) return base.map{|a|a} if rest.empty? rest = product_with(*rest, &constraint) base.inject([]){|rs, a| rest.inject(rs){|rs, b| if constraint.call a, b.kind_of?(Array)? b[0]: b rs<<[a, *b] else rs en…