示例#1
0
 /// <summary>
 /// Defines a monadic transformation List[Option[X]] -> Option[List[X]]
 /// that returns the value of the list if all items are valued; otherwise,
 /// returns None
 /// </summary>
 /// <typeparam name="X">The item type</typeparam>
 /// <param name="list">The list of options to transform</param>
 /// <returns></returns>
 public static Option <Lst <X> > flip <X>(Lst <Option <X> > list)
 => list.Any(item => item.IsNone())
     ? default  : list.Select(x => x.ValueOrDefault());
示例#2
0
 private bool CheckLineWiner(Shapes shape) =>
 Cells.Any(row => row.ForAll(c => c == shape));