Ejemplo n.º 1
0
 /// <summary>
 /// Find the product of the Somes.
 /// For numeric values the behaviour is to multiply the Somes (lhs * rhs)
 /// For Lst values the behaviour is to multiply all combinations of values in both lists
 /// to produce a new list
 /// Otherwise if the T type derives from IProductable then the behaviour
 /// is to call lhs.Product(rhs);
 /// </summary>
 /// <param name="lhs">Left-hand side of the operation</param>
 /// <param name="rhs">Right-hand side of the operation</param>
 /// <returns>lhs * rhs</returns>
 public Option <T> Product(Option <T> rhs)
 {
     if (IsNone)
     {
         return(this);            // zero * rhs = zero
     }
     if (rhs.IsNone)
     {
         return(rhs);             // lhs * zero = zero
     }
     return(Optional(TypeDesc.Product(Value, rhs.Value, TypeDesc <T> .Default)));
 }
Ejemplo n.º 2
0
 public Lst <T> Product(Lst <T> rhs) =>
 (from x in this.AsEnumerable()
  from y in rhs.AsEnumerable()
  select TypeDesc.Product(x, y, TypeDesc <T> .Default)).Freeze();
Ejemplo n.º 3
0
 public Set <T> Product(Set <T> rhs) =>
 new Set <T>((from x in this.AsEnumerable()
              from y in rhs.AsEnumerable()
              select TypeDesc.Product(x, y, TypeDesc <T> .Default)).Distinct());